
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>地理位置 · Elasticsearch权威指南中文版</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="WS">
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-anchors/plugin.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-ace/ace.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-emphasize/plugin.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search-plus/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="6_Geolocation.html" />
    
    
    <link rel="prev" href="5_2_Aggregations.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    序言
            
                </a>
            

            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="1Preface.html">
            
                <a href="1Preface.html">
            
                    
                    前言
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.1" data-path="1Preface.html">
            
                <a href="1Preface.html#谁应该读这本书">
            
                    
                    谁应该读这本书
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2" data-path="1Preface.html">
            
                <a href="1Preface.html#为什么我们要写这本书">
            
                    
                    为什么我们要写这本书
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3" data-path="1Preface.html">
            
                <a href="1Preface.html#Elasticsearch版本">
            
                    
                    Elasticsearch版本
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.4" data-path="1Preface.html">
            
                <a href="1Preface.html#如何读这本书">
            
                    
                    如何读这本书
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.5" data-path="1Preface.html">
            
                <a href="1Preface.html#本书导航">
            
                    
                    本书导航
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.6" data-path="1Preface.html">
            
                <a href="1Preface.html#在线资源">
            
                    
                    在线资源
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.7" data-path="1Preface.html">
            
                <a href="1Preface.html#本书协议约定">
            
                    
                    本书协议约定
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.8" data-path="1Preface.html">
            
                <a href="1Preface.html#使用代码示例">
            
                    
                    使用代码示例
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.9" data-path="1Preface.html">
            
                <a href="1Preface.html#鸣谢">
            
                    
                    鸣谢
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html">
            
                    
                    基础入门
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1.1" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#你知道的为了搜索">
            
                    
                    你知道的, 为了搜索…
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1.1.1" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#安装并运行Elasticsearch">
            
                    
                    安装并运行Elasticsearch
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.1.2" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#安装Sense">
            
                    
                    安装Sense
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.1.3" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#和Elasticsearch交互">
            
                    
                    和Elasticsearch交互
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.1.4" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#面向文档">
            
                    
                    面向文档
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.1.5" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#适应新环境">
            
                    
                    适应新环境
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.1.6" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#索引雇员文档">
            
                    
                    索引雇员文档
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.1.7" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#检索文档">
            
                    
                    检索文档
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.1.8" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#轻量搜索">
            
                    
                    轻量搜索
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.1.9" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#使用查询表达式搜索">
            
                    
                    使用查询表达式搜索
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.1.10" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#更复杂的搜索">
            
                    
                    更复杂的搜索
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.1.11" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#全文搜索">
            
                    
                    全文搜索
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.1.12" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#短语搜索">
            
                    
                    短语搜索
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.1.13" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#高亮搜索">
            
                    
                    高亮搜索
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.1.14" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#分析">
            
                    
                    分析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.1.15" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#教程结语">
            
                    
                    教程结语
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.1.16" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#分布式特性">
            
                    
                    分布式特性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.1.17" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#">
            
                    
                    后续步骤
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.1.2" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#集群内的原理">
            
                    
                    集群内的原理
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1.2.1" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#空集群">
            
                    
                    空集群
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.2.2" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#集群健康">
            
                    
                    集群健康
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.2.3" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#添加索引">
            
                    
                    添加索引
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.2.4" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#添加故障转">
            
                    
                    添加故障转
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.2.5" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#水平扩容">
            
                    
                    水平扩容
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.2.6" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#应对故障">
            
                    
                    应对故障
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.1.3" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#数据输入和输出">
            
                    
                    数据输入和输出
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1.3.1" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#什么是文档">
            
                    
                    什么是文档?
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.3.2" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#文档元数据">
            
                    
                    文档元数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.3.3" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#索引文档">
            
                    
                    索引文档
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.3.4" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#取回一个文档">
            
                    
                    取回一个文档
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.3.5" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#检查文档是否存在">
            
                    
                    检查文档是否存在
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.3.6" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#更新整个文档">
            
                    
                    更新整个文档
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.3.7" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#创建新文档">
            
                    
                    创建新文档
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.3.8" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#删除文档">
            
                    
                    删除文档
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.3.9" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#处理冲突">
            
                    
                    处理冲突
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.3.10" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#乐观并发控制">
            
                    
                    乐观并发控制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.3.11" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#文档的部分更新">
            
                    
                    文档的部分更新
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.3.12" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#取回多个文档">
            
                    
                    取回多个文档
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.3.13" data-path="2_1_Introductory.html">
            
                <a href="2_1_Introductory.html#代价较小的批量操作">
            
                    
                    代价较小的批量操作
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.1.4" data-path="2_2_Introductory.html">
            
                <a href="2_2_Introductory.html#分布式文档存储">
            
                    
                    分布式文档存储
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1.4.1" data-path="2_2_Introductory.html">
            
                <a href="2_2_Introductory.html#路由一个文档到一个分片中">
            
                    
                    路由一个文档到一个分片中
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.4.2" data-path="2_2_Introductory.html">
            
                <a href="2_2_Introductory.html#主分片和副本分片如何交互">
            
                    
                    主分片和副本分片如何交互
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.4.3" data-path="2_2_Introductory.html">
            
                <a href="2_2_Introductory.html#新建索引和删除文档">
            
                    
                    新建、索引和删除文档
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.4.4" data-path="2_2_Introductory.html">
            
                <a href="2_2_Introductory.html#取回一个文档">
            
                    
                    取回一个文档
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.4.5" data-path="2_2_Introductory.html">
            
                <a href="2_2_Introductory.html#局部更新文档">
            
                    
                    局部更新文档
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.4.6" data-path="2_2_Introductory.html">
            
                <a href="2_2_Introductory.html#多文档模式">
            
                    
                    多文档模式
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.1.5" data-path="2_2_Introductory.html">
            
                <a href="2_2_Introductory.html#搜索最基本的工具">
            
                    
                    搜索——最基本的工具
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1.5.1" data-path="2_2_Introductory.html">
            
                <a href="2_2_Introductory.html#空搜索">
            
                    
                    空搜索
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.5.2" data-path="2_2_Introductory.html">
            
                <a href="2_2_Introductory.html#多索引多类型">
            
                    
                    多索引，多类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.5.3" data-path="2_2_Introductory.html">
            
                <a href="2_2_Introductory.html#分页">
            
                    
                    分页
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.5.4" data-path="2_2_Introductory.html">
            
                <a href="2_2_Introductory.html#轻量搜索">
            
                    
                    轻量搜索
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.1.6" data-path="2_2_Introductory.html">
            
                <a href="2_2_Introductory.html#映射和分析">
            
                    
                    映射和分析
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1.6.1" data-path="2_2_Introductory.html">
            
                <a href="2_2_Introductory.html#精确值VS全文">
            
                    
                    精确值 VS 全文
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.6.2" data-path="2_2_Introductory.html">
            
                <a href="2_2_Introductory.html#倒排索引">
            
                    
                    倒排索引
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.6.3" data-path="2_2_Introductory.html">
            
                <a href="2_2_Introductory.html#分析与分析器">
            
                    
                    分析与分析器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.6.4" data-path="2_2_Introductory.html">
            
                <a href="2_2_Introductory.html#映射">
            
                    
                    映射
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.6.5" data-path="2_2_Introductory.html">
            
                <a href="2_2_Introductory.html#复杂核心域类型">
            
                    
                    复杂核心域类型
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.1.7" data-path="2_3_Introductory.html">
            
                <a href="2_3_Introductory.html#请求体查询">
            
                    
                    请求体查询
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1.7.1" data-path="2_3_Introductory.html">
            
                <a href="2_3_Introductory.html#空查询">
            
                    
                    空查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.7.2" data-path="2_3_Introductory.html">
            
                <a href="2_3_Introductory.html#查询表达式">
            
                    
                    查询表达式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.7.3" data-path="2_3_Introductory.html">
            
                <a href="2_3_Introductory.html#查询与过滤">
            
                    
                    查询与过滤
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.7.4" data-path="2_3_Introductory.html">
            
                <a href="2_3_Introductory.html#最重要的查询">
            
                    
                    最重要的查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.7.5" data-path="2_3_Introductory.html">
            
                <a href="2_3_Introductory.html#组合多查询">
            
                    
                    组合多查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.7.6" data-path="2_3_Introductory.html">
            
                <a href="2_3_Introductory.html#验证查询">
            
                    
                    验证查询
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.1.8" data-path="2_3_Introductory.html">
            
                <a href="2_3_Introductory.html#排序与相关性">
            
                    
                    排序与相关性
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1.8.1" data-path="2_3_Introductory.html">
            
                <a href="2_3_Introductory.html#排序">
            
                    
                    排序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.8.2" data-path="2_3_Introductory.html">
            
                <a href="2_3_Introductory.html#字符串排序与多字段">
            
                    
                    字符串排序与多字段
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.8.3" data-path="2_3_Introductory.html">
            
                <a href="2_3_Introductory.html#什么是相关性">
            
                    
                    什么是相关性?
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.8.4" data-path="2_3_Introductory.html">
            
                <a href="2_3_Introductory.html#DocValues介绍">
            
                    
                    Doc Values 介绍
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.1.9" data-path="2_3_Introductory.html">
            
                <a href="2_3_Introductory.html#执行分布式检索">
            
                    
                    执行分布式检索
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1.9.1" data-path="2_3_Introductory.html">
            
                <a href="2_3_Introductory.html#查询阶段">
            
                    
                    查询阶段
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.9.2" data-path="2_3_Introductory.html">
            
                <a href="2_3_Introductory.html#取回阶段">
            
                    
                    取回阶段
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.9.3" data-path="2_3_Introductory.html">
            
                <a href="2_3_Introductory.html#搜索选项">
            
                    
                    搜索选项
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.9.4" data-path="2_3_Introductory.html">
            
                <a href="2_3_Introductory.html#游标查询Scroll">
            
                    
                    游标查询 Scroll
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.1.10" data-path="2_4_Introductory.html">
            
                <a href="2_4_Introductory.html#索引管理">
            
                    
                    索引管理
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1.10.1" data-path="2_4_Introductory.html">
            
                <a href="2_4_Introductory.html#创建一个索引">
            
                    
                    创建一个索引
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.10.2" data-path="2_4_Introductory.html">
            
                <a href="2_4_Introductory.html#删除一个索引">
            
                    
                    删除一个索引
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.10.3" data-path="2_4_Introductory.html">
            
                <a href="2_4_Introductory.html#索引设置">
            
                    
                    索引设置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.10.4" data-path="2_4_Introductory.html">
            
                <a href="2_4_Introductory.html#配置分析器">
            
                    
                    配置分析器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.10.5" data-path="2_4_Introductory.html">
            
                <a href="2_4_Introductory.html#自定义分析器">
            
                    
                    自定义分析器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.10.6" data-path="2_4_Introductory.html">
            
                <a href="2_4_Introductory.html#类型和映射">
            
                    
                    类型和映射
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.10.7" data-path="2_4_Introductory.html">
            
                <a href="2_4_Introductory.html#根对象">
            
                    
                    根对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.10.8" data-path="2_4_Introductory.html">
            
                <a href="2_4_Introductory.html#动态映射">
            
                    
                    动态映射
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.10.9" data-path="2_4_Introductory.html">
            
                <a href="2_4_Introductory.html#自定义动态映射">
            
                    
                    自定义动态映射
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.10.10" data-path="2_4_Introductory.html">
            
                <a href="2_4_Introductory.html#缺省映射">
            
                    
                    缺省映射
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.10.11" data-path="2_4_Introductory.html">
            
                <a href="2_4_Introductory.html#重新索引你的数据">
            
                    
                    重新索引你的数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.10.12" data-path="2_4_Introductory.html">
            
                <a href="2_4_Introductory.html#索引别名和零停机">
            
                    
                    索引别名和零停机
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.1.11" data-path="2_4_Introductory.html">
            
                <a href="2_4_Introductory.html#分片内部原理">
            
                    
                    分片内部原理
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1.11.1" data-path="2_4_Introductory.html">
            
                <a href="2_4_Introductory.html#使文本可被搜索">
            
                    
                    使文本可被搜索
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.11.2" data-path="2_4_Introductory.html">
            
                <a href="2_4_Introductory.html#动态更新索引">
            
                    
                    动态更新索引
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.11.3" data-path="2_4_Introductory.html">
            
                <a href="2_4_Introductory.html#近实时搜索">
            
                    
                    近实时搜索
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.11.4" data-path="2_4_Introductory.html">
            
                <a href="2_4_Introductory.html#持久化变更">
            
                    
                    持久化变更
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.11.5" data-path="2_4_Introductory.html">
            
                <a href="2_4_Introductory.html#段合并">
            
                    
                    段合并
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#深入搜索">
            
                    
                    深入搜索
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1.1" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#结构化搜索">
            
                    
                    结构化搜索
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1.1.1" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#精确值查找">
            
                    
                    精确值查找
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.1.2" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#组合过滤器">
            
                    
                    组合过滤器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.1.3" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#查找多个精确值">
            
                    
                    查找多个精确值
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.1.4" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#范围">
            
                    
                    范围
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.1.5" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#处理Null值">
            
                    
                    处理 Null 值
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.1.6" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#关于缓存">
            
                    
                    关于缓存
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.1.2" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#全文搜索">
            
                    
                    全文搜索
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1.2.1" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#基于词项与基于全文">
            
                    
                    基于词项与基于全文
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.2.2" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#匹配查询">
            
                    
                    匹配查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.2.3" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#多词查询">
            
                    
                    多词查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.2.4" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#组合查询">
            
                    
                    组合查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.2.5" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#如何使用布尔匹配">
            
                    
                    如何使用布尔匹配
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.2.6" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#查询语句提升权重">
            
                    
                    查询语句提升权重
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.2.7" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#控制分析">
            
                    
                    控制分析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.2.8" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#被破坏的相关度">
            
                    
                    被破坏的相关度！
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.1.3" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#多字段搜索">
            
                    
                    多字段搜索
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1.3.1" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#多字符串查询">
            
                    
                    多字符串查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.3.2" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#单字符串查询">
            
                    
                    单字符串查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.3.3" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#最佳字段">
            
                    
                    最佳字段
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.3.4" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#最佳字段查询调优">
            
                    
                    最佳字段查询调优
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.3.5" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#multi_match查询">
            
                    
                    multi_match 查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.3.6" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#多数字段">
            
                    
                    多数字段
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.3.7" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#跨字段实体搜索">
            
                    
                    跨字段实体搜索
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.3.8" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#字段中心式查询">
            
                    
                    字段中心式查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.3.9" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#自定义all字段">
            
                    
                    自定义 _all 字段
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.3.10" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#crossfields跨字段查询">
            
                    
                    cross-fields 跨字段查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.3.11" data-path="3_1_DeepSearch.html">
            
                <a href="3_1_DeepSearch.html#ExactValue精确值字段">
            
                    
                    Exact-Value 精确值字段
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.1.4" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#近似匹配">
            
                    
                    近似匹配
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1.4.1" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#短语匹配">
            
                    
                    短语匹配
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.4.2" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#混合起来">
            
                    
                    混合起来
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.4.3" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#多值字段">
            
                    
                    多值字段
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.4.4" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#越近越好">
            
                    
                    越近越好
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.4.5" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#使用邻近度提高相关度">
            
                    
                    使用邻近度提高相关度
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.4.6" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#性能优化">
            
                    
                    性能优化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.4.7" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#寻找相关词">
            
                    
                    寻找相关词
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.1.5" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#部分匹配">
            
                    
                    部分匹配
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1.5.1" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#邮编与结构化数据">
            
                    
                    邮编与结构化数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.5.2" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#prefix前缀查询">
            
                    
                    prefix 前缀查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.5.3" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#通配符与正则表达式查询">
            
                    
                    通配符与正则表达式查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.5.4" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#查询时输入即搜索">
            
                    
                    查询时输入即搜索
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.5.5" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#索引时优化">
            
                    
                    索引时优化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.5.6" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#Ngrams在部分匹配的应用">
            
                    
                    Ngrams 在部分匹配的应用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.5.7" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#索引时输入即搜索">
            
                    
                    索引时输入即搜索
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.5.8" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#Ngrams在复合词的应用">
            
                    
                    Ngrams 在复合词的应用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.1.6" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#控制相关度">
            
                    
                    控制相关度
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1.6.1" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#相关度评分背后的理论">
            
                    
                    相关度评分背后的理论
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.6.2" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#Lucene的实用评分函数">
            
                    
                    Lucene 的实用评分函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.6.3" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#查询时权重提升">
            
                    
                    查询时权重提升
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.6.4" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#使用查询结构修改相关度">
            
                    
                    使用查询结构修改相关度
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.6.5" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#NotQuiteNot">
            
                    
                    Not Quite Not
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.6.6" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#忽略TFIDF">
            
                    
                    忽略 TF/IDF
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.6.7" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#functionscore查询">
            
                    
                    function_score 查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.6.8" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#按受欢迎度提升权重">
            
                    
                    按受欢迎度提升权重
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.6.9" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#过滤集提升权重">
            
                    
                    过滤集提升权重
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.6.10" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#随机评分">
            
                    
                    随机评分
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.6.11" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#越近越好">
            
                    
                    越近越好
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.6.12" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#理解price价格语句">
            
                    
                    理解 price 价格语句
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.6.13" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#脚本评分">
            
                    
                    脚本评分
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.6.14" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#可插拔的相似度算法">
            
                    
                    可插拔的相似度算法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.6.15" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#更改相似度">
            
                    
                    更改相似度
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.6.16" data-path="3_2_DeepSearch.html">
            
                <a href="3_2_DeepSearch.html#调试相关度是最后10要做的事情">
            
                    
                    调试相关度是最后 10% 要做的事情
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="5.1" data-path="4_1_Dealing_with_language.html">
            
                <a href="4_1_Dealing_with_language.html#处理人类语言">
            
                    
                    处理人类语言
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1.1" data-path="4_1_Dealing_with_language.html">
            
                <a href="4_1_Dealing_with_language.html#开始处理各种语言">
            
                    
                    开始处理各种语言
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1.1.1" data-path="4_1_Dealing_with_language.html">
            
                <a href="4_1_Dealing_with_language.html#使用语言分析器">
            
                    
                    使用语言分析器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.1.2" data-path="4_1_Dealing_with_language.html">
            
                <a href="4_1_Dealing_with_language.html#配置语言分析器">
            
                    
                    配置语言分析器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.1.3" data-path="4_1_Dealing_with_language.html">
            
                <a href="4_1_Dealing_with_language.html#混合语言的陷阱">
            
                    
                    混合语言的陷阱
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.1.4" data-path="4_1_Dealing_with_language.html">
            
                <a href="4_1_Dealing_with_language.html#每份文档一种语言">
            
                    
                    每份文档一种语言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.1.5" data-path="4_1_Dealing_with_language.html">
            
                <a href="4_1_Dealing_with_language.html#每个域一种语言">
            
                    
                    每个域一种语言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.1.6" data-path="4_1_Dealing_with_language.html">
            
                <a href="4_1_Dealing_with_language.html#混合语言域">
            
                    
                    混合语言域
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5.1.2" data-path="4_1_Dealing_with_language.html">
            
                <a href="4_1_Dealing_with_language.html#词汇识别">
            
                    
                    词汇识别
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1.2.1" data-path="4_1_Dealing_with_language.html">
            
                <a href="4_1_Dealing_with_language.html#标准分析器">
            
                    
                    标准分析器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.2.2" data-path="4_1_Dealing_with_language.html">
            
                <a href="4_1_Dealing_with_language.html#标准分词器">
            
                    
                    标准分词器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.2.3" data-path="4_1_Dealing_with_language.html">
            
                <a href="4_1_Dealing_with_language.html#安装ICU插件">
            
                    
                    安装 ICU 插件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.2.4" data-path="4_1_Dealing_with_language.html">
            
                <a href="4_1_Dealing_with_language.html#icu分词器">
            
                    
                    icu_分词器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.2.5" data-path="4_1_Dealing_with_language.html">
            
                <a href="4_1_Dealing_with_language.html#整理输入文本">
            
                    
                    整理输入文本
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5.1.3" data-path="4_1_Dealing_with_language.html">
            
                <a href="4_1_Dealing_with_language.html#归一化词元">
            
                    
                    归一化词元
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1.3.1" data-path="4_1_Dealing_with_language.html">
            
                <a href="4_1_Dealing_with_language.html#举个例子">
            
                    
                    举个例子
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.3.2" data-path="4_1_Dealing_with_language.html">
            
                <a href="4_1_Dealing_with_language.html#如果有口音">
            
                    
                    如果有口音
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.3.3" data-path="4_1_Dealing_with_language.html">
            
                <a href="4_1_Dealing_with_language.html#Unicode的世界">
            
                    
                    Unicode的世界
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.3.4" data-path="4_1_Dealing_with_language.html">
            
                <a href="4_1_Dealing_with_language.html#Unicode大小写折叠">
            
                    
                    Unicode 大小写折叠
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.3.5" data-path="4_1_Dealing_with_language.html">
            
                <a href="4_1_Dealing_with_language.html#Unicode字符折叠">
            
                    
                    Unicode 字符折叠
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.3.6" data-path="4_1_Dealing_with_language.html">
            
                <a href="4_1_Dealing_with_language.html#排序和整理">
            
                    
                    排序和整理
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5.1.4" data-path="4_1_Dealing_with_language.html">
            
                <a href="4_1_Dealing_with_language.html#将单词还原为词根">
            
                    
                    将单词还原为词根
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1.4.1" data-path="4_1_Dealing_with_language.html">
            
                <a href="4_1_Dealing_with_language.html#词干提取算法">
            
                    
                    词干提取算法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.4.2" data-path="4_1_Dealing_with_language.html">
            
                <a href="4_1_Dealing_with_language.html#字典词干提取器">
            
                    
                    字典词干提取器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.4.3" data-path="4_1_Dealing_with_language.html">
            
                <a href="4_1_Dealing_with_language.html#Hunspell词干提取器">
            
                    
                    Hunspell 词干提取器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.4.4" data-path="4_1_Dealing_with_language.html">
            
                <a href="4_1_Dealing_with_language.html#选择一个词干提取器">
            
                    
                    选择一个词干提取器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.4.5" data-path="4_1_Dealing_with_language.html">
            
                <a href="4_1_Dealing_with_language.html#控制词干提取">
            
                    
                    控制词干提取
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.4.6" data-path="4_1_Dealing_with_language.html">
            
                <a href="4_1_Dealing_with_language.html#原形词干提取">
            
                    
                    原形词干提取
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5.1.5" data-path="4_2_Dealing_with_language.html">
            
                <a href="4_2_Dealing_with_language.html#停用词性能与精度">
            
                    
                    停用词: 性能与精度
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1.5.1" data-path="4_2_Dealing_with_language.html">
            
                <a href="4_2_Dealing_with_language.html#停用词的优缺点">
            
                    
                    停用词的优缺点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.5.2" data-path="4_2_Dealing_with_language.html">
            
                <a href="4_2_Dealing_with_language.html#使用停用词">
            
                    
                    使用停用词
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.5.3" data-path="4_2_Dealing_with_language.html">
            
                <a href="4_2_Dealing_with_language.html#停用词与性能">
            
                    
                    停用词与性能
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.5.4" data-path="4_2_Dealing_with_language.html">
            
                <a href="4_2_Dealing_with_language.html#词项的分别管理">
            
                    
                    词项的分别管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.5.5" data-path="4_2_Dealing_with_language.html">
            
                <a href="4_2_Dealing_with_language.html#停用词与短语查询">
            
                    
                    停用词与短语查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.5.6" data-path="4_2_Dealing_with_language.html">
            
                <a href="4_2_Dealing_with_language.html#commongrams过滤器">
            
                    
                    common_grams 过滤器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.5.7" data-path="4_2_Dealing_with_language.html">
            
                <a href="4_2_Dealing_with_language.html#停用词与相关性">
            
                    
                    停用词与相关性
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5.1.6" data-path="4_2_Dealing_with_language.html">
            
                <a href="4_2_Dealing_with_language.html#同义词">
            
                    
                    同义词
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1.6.1" data-path="4_2_Dealing_with_language.html">
            
                <a href="4_2_Dealing_with_language.html#使用同义词">
            
                    
                    使用同义词
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.6.2" data-path="4_2_Dealing_with_language.html">
            
                <a href="4_2_Dealing_with_language.html#同义词格式">
            
                    
                    同义词格式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.6.3" data-path="4_2_Dealing_with_language.html">
            
                <a href="4_2_Dealing_with_language.html#扩展或收缩">
            
                    
                    扩展或收缩
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.6.4" data-path="4_2_Dealing_with_language.html">
            
                <a href="4_2_Dealing_with_language.html#同义词和分析链">
            
                    
                    同义词和分析链
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.6.5" data-path="4_2_Dealing_with_language.html">
            
                <a href="4_2_Dealing_with_language.html#多词同义词和短语查询">
            
                    
                    多词同义词和短语查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.6.6" data-path="4_2_Dealing_with_language.html">
            
                <a href="4_2_Dealing_with_language.html#符号同义词">
            
                    
                    符号同义词
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5.1.7" data-path="4_2_Dealing_with_language.html">
            
                <a href="4_2_Dealing_with_language.html#拼写错误">
            
                    
                    拼写错误
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1.7.1" data-path="4_2_Dealing_with_language.html">
            
                <a href="4_2_Dealing_with_language.html#模糊性">
            
                    
                    模糊性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.7.2" data-path="4_2_Dealing_with_language.html">
            
                <a href="4_2_Dealing_with_language.html#模糊查询">
            
                    
                    模糊查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.7.3" data-path="4_2_Dealing_with_language.html">
            
                <a href="4_2_Dealing_with_language.html#模糊匹配查询">
            
                    
                    模糊匹配查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.7.4" data-path="4_2_Dealing_with_language.html">
            
                <a href="4_2_Dealing_with_language.html#模糊性评分">
            
                    
                    模糊性评分
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.7.5" data-path="4_2_Dealing_with_language.html">
            
                <a href="4_2_Dealing_with_language.html#语音匹配">
            
                    
                    语音匹配
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="6.1" data-path="5_1_Aggregations.html">
            
                <a href="5_1_Aggregations.html#聚合">
            
                    
                    聚合
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1.1" data-path="5_1_Aggregations.html">
            
                <a href="5_1_Aggregations.html#高阶概念">
            
                    
                    高阶概念
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1.1.1" data-path="5_1_Aggregations.html">
            
                <a href="5_1_Aggregations.html#桶">
            
                    
                    桶
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.1.2" data-path="5_1_Aggregations.html">
            
                <a href="5_1_Aggregations.html#指标">
            
                    
                    指标
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.1.3" data-path="5_1_Aggregations.html">
            
                <a href="5_1_Aggregations.html#桶和指标的组合">
            
                    
                    桶和指标的组合
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6.1.2" data-path="5_1_Aggregations.html">
            
                <a href="5_1_Aggregations.html#尝试聚合">
            
                    
                    尝试聚合
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1.2.1" data-path="5_1_Aggregations.html">
            
                <a href="5_1_Aggregations.html#添加度量指标">
            
                    
                    添加度量指标
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.2.2" data-path="5_1_Aggregations.html">
            
                <a href="5_1_Aggregations.html#嵌套桶">
            
                    
                    嵌套桶
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.2.3" data-path="5_1_Aggregations.html">
            
                <a href="5_1_Aggregations.html#最后的修改">
            
                    
                    最后的修改
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6.1.3" data-path="5_1_Aggregations.html">
            
                <a href="5_1_Aggregations.html#条形图">
            
                    
                    条形图
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.4" data-path="5_1_Aggregations.html">
            
                <a href="5_1_Aggregations.html#按时间统计">
            
                    
                    按时间统计
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1.4.1" data-path="5_1_Aggregations.html">
            
                <a href="5_1_Aggregations.html#返回空Buckets">
            
                    
                    返回空 Buckets
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.4.2" data-path="5_1_Aggregations.html">
            
                <a href="5_1_Aggregations.html#扩展例子">
            
                    
                    扩展例子
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.4.3" data-path="5_1_Aggregations.html">
            
                <a href="5_1_Aggregations.html#潜力无穷">
            
                    
                    潜力无穷
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6.1.5" data-path="5_1_Aggregations.html">
            
                <a href="5_1_Aggregations.html#范围限定的聚合">
            
                    
                    范围限定的聚合
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.6" data-path="5_2_Aggregations.html">
            
                <a href="5_2_Aggregations.html#过滤和聚合">
            
                    
                    过滤和聚合
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1.6.1" data-path="5_2_Aggregations.html">
            
                <a href="5_2_Aggregations.html#过滤">
            
                    
                    过滤
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.6.2" data-path="5_2_Aggregations.html">
            
                <a href="5_2_Aggregations.html#过滤桶">
            
                    
                    过滤桶
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.6.3" data-path="5_2_Aggregations.html">
            
                <a href="5_2_Aggregations.html#后过滤器">
            
                    
                    后过滤器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.6.4" data-path="5_2_Aggregations.html">
            
                <a href="5_2_Aggregations.html#小结5_2">
            
                    
                    小结
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6.1.7" data-path="5_2_Aggregations.html">
            
                <a href="5_2_Aggregations.html#多桶排序">
            
                    
                    多桶排序
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1.7.1" data-path="5_2_Aggregations.html">
            
                <a href="5_2_Aggregations.html#内置排序">
            
                    
                    内置排序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.7.2" data-path="5_2_Aggregations.html">
            
                <a href="5_2_Aggregations.html#按度量排序">
            
                    
                    按度量排序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.7.3" data-path="5_2_Aggregations.html">
            
                <a href="5_2_Aggregations.html#基于深度度量排序">
            
                    
                    基于“深度”度量排序
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6.1.8" data-path="5_2_Aggregations.html">
            
                <a href="5_2_Aggregations.html#近似聚合">
            
                    
                    近似聚合
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1.8.1" data-path="5_2_Aggregations.html">
            
                <a href="5_2_Aggregations.html#统计去重后的数量">
            
                    
                    统计去重后的数量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.8.2" data-path="5_2_Aggregations.html">
            
                <a href="5_2_Aggregations.html#百分位计算">
            
                    
                    百分位计算
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6.1.9" data-path="5_2_Aggregations.html">
            
                <a href="5_2_Aggregations.html#通过聚合发现异常指标">
            
                    
                    通过聚合发现异常指标
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1.9.1" data-path="5_2_Aggregations.html">
            
                <a href="5_2_Aggregations.html#significantterms演示">
            
                    
                    significant_terms 演示
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6.1.10" data-path="5_2_Aggregations.html">
            
                <a href="5_2_Aggregations.html#DocValuesandFielddata">
            
                    
                    Doc Values and Fielddata
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1.10.1" data-path="5_2_Aggregations.html">
            
                <a href="5_2_Aggregations.html#DocValues">
            
                    
                    Doc Values
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.10.2" data-path="5_2_Aggregations.html">
            
                <a href="5_2_Aggregations.html#深入理解DocValues">
            
                    
                    深入理解 Doc Values
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.10.3" data-path="5_2_Aggregations.html">
            
                <a href="5_2_Aggregations.html#聚合与分析">
            
                    
                    聚合与分析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.10.4" data-path="5_2_Aggregations.html">
            
                <a href="5_2_Aggregations.html#限制内存使用">
            
                    
                    限制内存使用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.10.5" data-path="5_2_Aggregations.html">
            
                <a href="5_2_Aggregations.html#Fielddata的过滤">
            
                    
                    Fielddata 的过滤
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.10.6" data-path="5_2_Aggregations.html">
            
                <a href="5_2_Aggregations.html#预加载fielddata">
            
                    
                    预加载 fielddata
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.10.7" data-path="5_2_Aggregations.html">
            
                <a href="5_2_Aggregations.html#优化聚合查询">
            
                    
                    优化聚合查询
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6.1.11" data-path="5_2_Aggregations.html">
            
                <a href="5_2_Aggregations.html#总结5_2">
            
                    
                    总结
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="7.1" data-path="6_Geolocation.html">
            
                <a href="6_Geolocation.html#地理位置">
            
                    
                    地理位置
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.1.1" data-path="6_Geolocation.html">
            
                <a href="6_Geolocation.html#地理坐标点">
            
                    
                    地理坐标点
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.1.1.1" data-path="6_Geolocation.html">
            
                <a href="6_Geolocation.html#经纬度坐标格式">
            
                    
                    经纬度坐标格式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.1.2" data-path="6_Geolocation.html">
            
                <a href="6_Geolocation.html#通过地理坐标点过滤">
            
                    
                    通过地理坐标点过滤
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.1.3" data-path="6_Geolocation.html">
            
                <a href="6_Geolocation.html#地理坐标盒模型过滤器">
            
                    
                    地理坐标盒模型过滤器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.1.4" data-path="6_Geolocation.html">
            
                <a href="6_Geolocation.html#地理距离过滤器">
            
                    
                    地理距离过滤器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.1.5" data-path="6_Geolocation.html">
            
                <a href="6_Geolocation.html#按距离排序">
            
                    
                    按距离排序
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="7.1.2" data-path="6_Geolocation.html">
            
                <a href="6_Geolocation.html#Geohashes6">
            
                    
                    Geohashes
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.1.2.1" data-path="6_Geolocation.html">
            
                <a href="6_Geolocation.html#Geohashes映射">
            
                    
                    Geohashes 映射
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.2.2" data-path="6_Geolocation.html">
            
                <a href="6_Geolocation.html#Geohash单元查询">
            
                    
                    Geohash 单元查询
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="7.1.3" data-path="6_Geolocation.html">
            
                <a href="6_Geolocation.html#地理位置聚合">
            
                    
                    地理位置聚合
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.1.3.1" data-path="6_Geolocation.html">
            
                <a href="6_Geolocation.html#地理距离聚合">
            
                    
                    地理距离聚合
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.3.2" data-path="6_Geolocation.html">
            
                <a href="6_Geolocation.html#Geohash网格聚合">
            
                    
                    Geohash 网格聚合
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.3.3" data-path="6_Geolocation.html">
            
                <a href="6_Geolocation.html#地理边界聚合">
            
                    
                    地理边界聚合
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="7.1.4" data-path="6_Geolocation.html">
            
                <a href="6_Geolocation.html#地理形状">
            
                    
                    地理形状
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.1.4.1" data-path="6_Geolocation.html">
            
                <a href="6_Geolocation.html#映射地理形状">
            
                    
                    映射地理形状
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.4.2" data-path="6_Geolocation.html">
            
                <a href="6_Geolocation.html#索引地理形状">
            
                    
                    索引地理形状
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.4.3" data-path="6_Geolocation.html">
            
                <a href="6_Geolocation.html#查询地理形状">
            
                    
                    查询地理形状
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.4.4" data-path="6_Geolocation.html">
            
                <a href="6_Geolocation.html#在查询中使用已索引的形状">
            
                    
                    在查询中使用已索引的形状
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="8.1" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#数据建模">
            
                    
                    数据建模
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="8.1.1" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#关联关系处理">
            
                    
                    关联关系处理
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="8.1.1.1" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#应用层联接">
            
                    
                    应用层联接
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.1.2" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#非规范化你的数据">
            
                    
                    非规范化你的数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.1.3" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#字段折叠">
            
                    
                    字段折叠
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.1.4" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#非规范化和并发">
            
                    
                    非规范化和并发
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.1.5" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#解决并发问题">
            
                    
                    解决并发问题
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="8.1.2" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#嵌套对象">
            
                    
                    嵌套对象
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="8.1.2.1" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#嵌套对象映射">
            
                    
                    嵌套对象映射
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.2.2" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#嵌套对象查询">
            
                    
                    嵌套对象查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.2.3" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#使用嵌套字段排序">
            
                    
                    使用嵌套字段排序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.2.4" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#嵌套聚合">
            
                    
                    嵌套聚合
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="8.1.3" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#父子关系文档">
            
                    
                    父-子关系文档
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="8.1.3.1" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#父子关系文档映射">
            
                    
                    父-子关系文档映射
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.3.2" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#构建父子文档索引">
            
                    
                    构建父-子文档索引
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.3.3" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#通过子文档查询父文档">
            
                    
                    通过子文档查询父文档
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.3.4" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#通过父文档查询子文档">
            
                    
                    通过父文档查询子文档
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.3.5" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#子文档聚合">
            
                    
                    子文档聚合
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.3.6" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#祖辈与孙辈关系">
            
                    
                    祖辈与孙辈关系
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.3.7" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#实际使用中的一些建议">
            
                    
                    实际使用中的一些建议
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="8.1.4" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#扩容设计">
            
                    
                    扩容设计
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="8.1.4.1" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#扩容的单元">
            
                    
                    扩容的单元
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.4.2" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#分片预分配">
            
                    
                    分片预分配
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.4.3" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#海量分片">
            
                    
                    海量分片
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.4.4" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#容量规划">
            
                    
                    容量规划
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.4.5" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#副本分片">
            
                    
                    副本分片
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.4.6" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#多索引">
            
                    
                    多索引
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.4.7" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#基于时间的数据">
            
                    
                    基于时间的数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.4.8" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#索引模板">
            
                    
                    索引模板
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.4.9" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#数据过期">
            
                    
                    数据过期
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.4.10" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#基于用户的数据">
            
                    
                    基于用户的数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.4.11" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#共享索引">
            
                    
                    共享索引
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.4.12" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#利用别名实现一个用户一个索引">
            
                    
                    利用别名实现一个用户一个索引
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.4.13" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#一个大的用户">
            
                    
                    一个大的用户
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.4.14" data-path="7_Modeling_your_data.html">
            
                <a href="7_Modeling_your_data.html#扩容并不是无限的">
            
                    
                    扩容并不是无限的
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="9.1" data-path="8_Admin.html">
            
                <a href="8_Admin.html#管理监控和部署">
            
                    
                    管理、监控和部署
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="9.1.1" data-path="8_Admin.html">
            
                <a href="8_Admin.html#监控">
            
                    
                    监控
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="9.1.1.1" data-path="8_Admin.html">
            
                <a href="8_Admin.html#Marvel监控">
            
                    
                    Marvel 监控
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.1.2" data-path="8_Admin.html">
            
                <a href="8_Admin.html#集群健康">
            
                    
                    集群健康
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.1.3" data-path="8_Admin.html">
            
                <a href="8_Admin.html#监控单个节点">
            
                    
                    监控单个节点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.1.4" data-path="8_Admin.html">
            
                <a href="8_Admin.html#集群统计">
            
                    
                    集群统计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.1.5" data-path="8_Admin.html">
            
                <a href="8_Admin.html#索引统计">
            
                    
                    索引统计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.1.6" data-path="8_Admin.html">
            
                <a href="8_Admin.html#等待中的任务">
            
                    
                    等待中的任务
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.1.7" data-path="8_Admin.html">
            
                <a href="8_Admin.html#catAPI">
            
                    
                    cat API
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="9.1.2" data-path="8_Admin.html">
            
                <a href="8_Admin.html#部署">
            
                    
                    部署
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="9.1.2.1" data-path="8_Admin.html">
            
                <a href="8_Admin.html#硬件">
            
                    
                    硬件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.2.2" data-path="8_Admin.html">
            
                <a href="8_Admin.html#Java虚拟机">
            
                    
                    Java 虚拟机
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.2.3" data-path="8_Admin.html">
            
                <a href="8_Admin.html#TransportClient与NodeClient">
            
                    
                    Transport Client 与 Node Client
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.2.4" data-path="8_Admin.html">
            
                <a href="8_Admin.html#配置管理">
            
                    
                    配置管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.2.5" data-path="8_Admin.html">
            
                <a href="8_Admin.html#重要配置的修改">
            
                    
                    重要配置的修改
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.2.6" data-path="8_Admin.html">
            
                <a href="8_Admin.html#不要触碰这些配置">
            
                    
                    不要触碰这些配置！
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.2.7" data-path="8_Admin.html">
            
                <a href="8_Admin.html#堆内存大小和交换">
            
                    
                    堆内存:大小和交换
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.2.8" data-path="8_Admin.html">
            
                <a href="8_Admin.html#文件描述符和MMap">
            
                    
                    文件描述符和 MMap
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.2.9" data-path="8_Admin.html">
            
                <a href="8_Admin.html#在生产之前，重温这个列表">
            
                    
                    在生产之前，重温这个列表
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="9.1.3" data-path="8_Admin.html">
            
                <a href="8_Admin.html#部署后">
            
                    
                    部署后
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="9.1.3.1" data-path="8_Admin.html">
            
                <a href="8_Admin.html#动态变更设置">
            
                    
                    动态变更设置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.3.2" data-path="8_Admin.html">
            
                <a href="8_Admin.html#日志记录">
            
                    
                    日志记录
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.3.3" data-path="8_Admin.html">
            
                <a href="8_Admin.html#索引性能技巧">
            
                    
                    索引性能技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.3.4" data-path="8_Admin.html">
            
                <a href="8_Admin.html#推迟分片分配">
            
                    
                    推迟分片分配
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.3.5" data-path="8_Admin.html">
            
                <a href="8_Admin.html#滚动重启">
            
                    
                    滚动重启
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.3.6" data-path="8_Admin.html">
            
                <a href="8_Admin.html#备份你的集群">
            
                    
                    备份你的集群
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.3.7" data-path="8_Admin.html">
            
                <a href="8_Admin.html#从快照恢复">
            
                    
                    从快照恢复
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.3.8" data-path="8_Admin.html">
            
                <a href="8_Admin.html#集群是活着的呼吸着的生命">
            
                    
                    集群是活着的、呼吸着的生命
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >地理位置</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div class="search-plus" id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-anchor"></i><ul><li><a href="#&#x5730;&#x7406;&#x4F4D;&#x7F6E;">&#x5730;&#x7406;&#x4F4D;&#x7F6E;</a></li><ul><li><a href="#&#x5730;&#x7406;&#x5750;&#x6807;&#x70B9;">&#x5730;&#x7406;&#x5750;&#x6807;&#x70B9;</a></li><ul><li><a href="#&#x7ECF;&#x7EAC;&#x5EA6;&#x5750;&#x6807;&#x683C;&#x5F0F;">&#x7ECF;&#x7EAC;&#x5EA6;&#x5750;&#x6807;&#x683C;&#x5F0F;</a></li><li><a href="#&#x901A;&#x8FC7;&#x5730;&#x7406;&#x5750;&#x6807;&#x70B9;&#x8FC7;&#x6EE4;">&#x901A;&#x8FC7;&#x5730;&#x7406;&#x5750;&#x6807;&#x70B9;&#x8FC7;&#x6EE4;</a></li><li><a href="#&#x5730;&#x7406;&#x5750;&#x6807;&#x76D2;&#x6A21;&#x578B;&#x8FC7;&#x6EE4;&#x5668;">&#x5730;&#x7406;&#x5750;&#x6807;&#x76D2;&#x6A21;&#x578B;&#x8FC7;&#x6EE4;&#x5668;</a></li><li><a href="#&#x5730;&#x7406;&#x8DDD;&#x79BB;&#x8FC7;&#x6EE4;&#x5668;">&#x5730;&#x7406;&#x8DDD;&#x79BB;&#x8FC7;&#x6EE4;&#x5668;</a></li><li><a href="#&#x6309;&#x8DDD;&#x79BB;&#x6392;&#x5E8F;">&#x6309;&#x8DDD;&#x79BB;&#x6392;&#x5E8F;</a></li></ul><li><a href="#Geohashes6">Geohashes  </a></li><ul><li><a href="#Geohashes&#x6620;&#x5C04;">Geohashes &#x6620;&#x5C04;  </a></li><li><a href="#Geohash&#x5355;&#x5143;&#x67E5;&#x8BE2;">Geohash &#x5355;&#x5143;&#x67E5;&#x8BE2;  </a></li></ul><li><a href="#&#x5730;&#x7406;&#x4F4D;&#x7F6E;&#x805A;&#x5408;">&#x5730;&#x7406;&#x4F4D;&#x7F6E;&#x805A;&#x5408;</a></li><ul><li><a href="#&#x5730;&#x7406;&#x8DDD;&#x79BB;&#x805A;&#x5408;">&#x5730;&#x7406;&#x8DDD;&#x79BB;&#x805A;&#x5408;</a></li><li><a href="#Geohash&#x7F51;&#x683C;&#x805A;&#x5408;">Geohash &#x7F51;&#x683C;&#x805A;&#x5408;  </a></li><li><a href="#&#x5730;&#x7406;&#x8FB9;&#x754C;&#x805A;&#x5408;">&#x5730;&#x7406;&#x8FB9;&#x754C;&#x805A;&#x5408;</a></li></ul><li><a href="#&#x5730;&#x7406;&#x5F62;&#x72B6;">&#x5730;&#x7406;&#x5F62;&#x72B6;</a></li><ul><li><a href="#&#x6620;&#x5C04;&#x5730;&#x7406;&#x5F62;&#x72B6;">&#x6620;&#x5C04;&#x5730;&#x7406;&#x5F62;&#x72B6;</a></li><li><a href="#&#x7D22;&#x5F15;&#x5730;&#x7406;&#x5F62;&#x72B6;">&#x7D22;&#x5F15;&#x5730;&#x7406;&#x5F62;&#x72B6;</a></li><li><a href="#&#x67E5;&#x8BE2;&#x5730;&#x7406;&#x5F62;&#x72B6;">&#x67E5;&#x8BE2;&#x5730;&#x7406;&#x5F62;&#x72B6;</a></li><li><a href="#&#x5728;&#x67E5;&#x8BE2;&#x4E2D;&#x4F7F;&#x7528;&#x5DF2;&#x7D22;&#x5F15;&#x7684;&#x5F62;&#x72B6;">&#x5728;&#x67E5;&#x8BE2;&#x4E2D;&#x4F7F;&#x7528;&#x5DF2;&#x7D22;&#x5F15;&#x7684;&#x5F62;&#x72B6;</a></li></ul></ul></ul></div><a href="#&#x5730;&#x7406;&#x4F4D;&#x7F6E;" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 id="&#x5730;&#x7406;&#x4F4D;&#x7F6E;"><a name="&#x5730;&#x7406;&#x4F4D;&#x7F6E;" class="anchor-navigation-ex-anchor" href="#&#x5730;&#x7406;&#x4F4D;&#x7F6E;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5730;&#x7406;&#x4F4D;&#x7F6E;</h1>
<p>&#x6211;&#x4EEC;&#x62FF;&#x7740;&#x7EB8;&#x8D28;&#x5730;&#x56FE;&#x6F2B;&#x6B65;&#x57CE;&#x5E02;&#x7684;&#x65E5;&#x5B50;&#x4E00;&#x53BB;&#x4E0D;&#x8FD4;&#x4E86;&#x3002;&#x5F97;&#x76CA;&#x4E8E;&#x667A;&#x80FD;&#x624B;&#x673A;&#xFF0C;&#x6211;&#x4EEC;&#x73B0;&#x5728;&#x603B;&#x662F;&#x53EF;&#x4EE5;&#x77E5;&#x9053; &#x81EA;&#x5DF1;&#x6240;&#x5904;&#x7684;&#x51C6;&#x786E;&#x4F4D;&#x7F6E;&#xFF0C;&#x4E5F;&#x9884;&#x6599;&#x5230;&#x7F51;&#x7AD9;&#x4F1A;&#x4F7F;&#x7528;&#x8FD9;&#x4E9B;&#x4FE1;&#x606F;&#x3002;&#x6211;&#x60F3;&#x77E5;&#x9053;&#x4ECE;&#x5F53;&#x524D;&#x4F4D;&#x7F6E;&#x6B65;&#x884C; 5 &#x5206;&#x949F;&#x5185;&#x53EF;&#x5230;&#x7684;&#x90A3;&#x4E9B;&#x9910;&#x9986;&#xFF0C;&#x5BF9;&#x4F26;&#x6566;&#x66F4;&#x5927;&#x8303;&#x56F4;&#x5185;&#x7684;&#x5176;&#x4ED6;&#x9910;&#x9986;&#x5E76;&#x4E0D;&#x611F;&#x5174;&#x8DA3;&#x3002;</p>
<p>&#x4F46;&#x5730;&#x7406;&#x4F4D;&#x7F6E;&#x529F;&#x80FD;&#x4EC5;&#x4EC5;&#x662F; Elasticsearch &#x7684;&#x51B0;&#x5C71;&#x4E00;&#x89D2;&#xFF0C;Elasticsearch &#x7684;&#x5999;&#x5904;&#x5728;&#x4E8E;&#xFF0C;&#x5B83;&#x8BA9;&#x4F60;&#x53EF;&#x4EE5;&#x628A;&#x5730;&#x7406;&#x4F4D;&#x7F6E;&#x3001;&#x5168;&#x6587;&#x641C;&#x7D22;&#x3001;&#x7ED3;&#x6784;&#x5316;&#x641C;&#x7D22;&#x548C;&#x5206;&#x6790;&#x7ED3;&#x5408;&#x5230;&#x4E00;&#x8D77;&#x3002;</p>
<p>&#x4F8B;&#x5982;&#xFF1A;&#x544A;&#x8BC9;&#x6211;&#x63D0;&#x5230; <em>vitello tonnato</em> &#x8FD9;&#x79CD;&#x98DF;&#x7269;&#x3001;&#x6B65;&#x884C; 5 &#x5206;&#x949F;&#x5185;&#x53EF;&#x5230;&#x3001;&#x4E14;&#x665A;&#x4E0A; 11 &#x70B9;&#x8FD8;&#x8425;&#x4E1A;&#x7684;&#x9910;&#x5385;&#xFF0C;&#x7136;&#x540E;&#x7ED3;&#x5408;&#x7528;&#x6237;&#x8BC4;&#x4EF7;&#x3001;&#x8DDD;&#x79BB;&#x3001;&#x4EF7;&#x683C;&#x6392;&#x5E8F;&#x3002;&#x53E6;&#x4E00;&#x4E2A;&#x4F8B;&#x5B50;&#xFF1A;&#x7ED9;&#x6211;&#x5C55;&#x793A;&#x4E00;&#x5E45;&#x6574;&#x4E2A;&#x57CE;&#x5E02;8&#x6708;&#x4EFD;&#x53EF;&#x7528;&#x5047;&#x671F;&#x51FA;&#x79DF;&#x7269;&#x4E1A;&#x7684;&#x5730;&#x56FE;&#xFF0C;&#x5E76;&#x8BA1;&#x7B97;&#x51FA;&#x6BCF;&#x4E2A;&#x533A;&#x57DF;&#x7684;&#x5E73;&#x5747;&#x4EF7;&#x683C;&#x3002;</p>
<p>Elasticsearch &#x63D0;&#x4F9B;&#x4E86; &#x4E24;&#x79CD;&#x8868;&#x793A;&#x5730;&#x7406;&#x4F4D;&#x7F6E;&#x7684;&#x65B9;&#x5F0F;&#xFF1A;&#x7528;&#x7EAC;&#x5EA6;&#xFF0D;&#x7ECF;&#x5EA6;&#x8868;&#x793A;&#x7684;&#x5750;&#x6807;&#x70B9;&#x4F7F;&#x7528; <code>geo_point</code> &#x5B57;&#x6BB5;&#x7C7B;&#x578B;&#xFF0C;&#x4EE5; <a href="http://en.wikipedia.org/wiki/GeoJSON" target="_blank">GeoJSON</a> &#x683C;&#x5F0F;&#x5B9A;&#x4E49;&#x7684;&#x590D;&#x6742;&#x5730;&#x7406;&#x5F62;&#x72B6;&#xFF0C;&#x4F7F;&#x7528; <code>geo_shape</code> &#x5B57;&#x6BB5;&#x7C7B;&#x578B;&#x3002;</p>
<p><em>Geo-points</em> &#x5141;&#x8BB8;&#x4F60;&#x627E;&#x5230;&#x8DDD;&#x79BB;&#x53E6;&#x4E00;&#x4E2A;&#x5750;&#x6807;&#x70B9;&#x4E00;&#x5B9A;&#x8303;&#x56F4;&#x5185;&#x7684;&#x5750;&#x6807;&#x70B9;&#x3001;&#x8BA1;&#x7B97;&#x51FA;&#x4E24;&#x70B9;&#x4E4B;&#x95F4;&#x7684;&#x8DDD;&#x79BB;&#x6765;&#x6392;&#x5E8F;&#x6216;&#x8FDB;&#x884C;&#x76F8;&#x5173;&#x6027;&#x6253;&#x5206;&#x3001;&#x6216;&#x8005;&#x805A;&#x5408;&#x5230;&#x663E;&#x793A;&#x5728;&#x5730;&#x56FE;&#x4E0A;&#x7684;&#x4E00;&#x4E2A;&#x7F51;&#x683C;&#x3002;&#x53E6;&#x4E00;&#x65B9;&#x9762;&#xFF0C;<em>Geo-shapes</em> &#x7EAF;&#x7CB9;&#x662F;&#x7528;&#x6765;&#x8FC7;&#x6EE4;&#x7684;&#x3002;&#x5B83;&#x4EEC;&#x53EF;&#x4EE5;&#x7528;&#x6765;&#x5224;&#x65AD;&#x4E24;&#x4E2A;&#x5730;&#x7406;&#x5F62;&#x72B6;&#x662F;&#x5426;&#x6709;&#x91CD;&#x5408;&#x6216;&#x8005;&#x67D0;&#x4E2A;&#x5730;&#x7406;&#x5F62;&#x72B6;&#x662F;&#x5426;&#x5B8C;&#x5168;&#x5305;&#x542B;&#x4E86;&#x5176;&#x4ED6;&#x5730;&#x7406;&#x5F62;&#x72B6;&#x3002;</p>
<h2 id="&#x5730;&#x7406;&#x5750;&#x6807;&#x70B9;"><a name="&#x5730;&#x7406;&#x5750;&#x6807;&#x70B9;" class="anchor-navigation-ex-anchor" href="#&#x5730;&#x7406;&#x5750;&#x6807;&#x70B9;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5730;&#x7406;&#x5750;&#x6807;&#x70B9;</h2>
<p><em>&#x5730;&#x7406;&#x5750;&#x6807;&#x70B9;</em> &#x662F;&#x6307;&#x5730;&#x7403;&#x8868;&#x9762;&#x53EF;&#x4EE5;&#x7528;&#x7ECF;&#x7EAC;&#x5EA6;&#x63CF;&#x8FF0;&#x7684;&#x4E00;&#x4E2A;&#x70B9;&#x3002; &#x5730;&#x7406;&#x5750;&#x6807;&#x70B9;&#x53EF;&#x4EE5;&#x7528;&#x6765;&#x8BA1;&#x7B97;&#x4E24;&#x4E2A;&#x5750;&#x6807;&#x95F4;&#x7684;&#x8DDD;&#x79BB;&#xFF0C;&#x8FD8;&#x53EF;&#x4EE5;&#x5224;&#x65AD;&#x4E00;&#x4E2A;&#x5750;&#x6807;&#x662F;&#x5426;&#x5728;&#x4E00;&#x4E2A;&#x533A;&#x57DF;&#x4E2D;&#xFF0C;&#x6216;&#x5728;&#x805A;&#x5408;&#x4E2D;&#x3002;</p>
<p>&#x5730;&#x7406;&#x5750;&#x6807;&#x70B9;&#x4E0D;&#x80FD;&#x88AB;&#x52A8;&#x6001;&#x6620;&#x5C04; &#xFF08;<a href="https://www.elastic.co/guide/cn/elasticsearch/guide/current/dynamic-mapping.html" target="_blank">dynamic mapping</a>&#xFF09;&#x81EA;&#x52A8;&#x68C0;&#x6D4B;&#xFF0C;&#x800C;&#x662F;&#x9700;&#x8981;&#x663E;&#x5F0F;&#x58F0;&#x660E;&#x5BF9;&#x5E94;&#x5B57;&#x6BB5;&#x7C7B;&#x578B;&#x4E3A; <code>geo-point</code> &#xFF1A;</p>
<pre><code class="lang-json">PUT /attractions
{
  <span class="hljs-string">&quot;mappings&quot;</span>: {
    <span class="hljs-string">&quot;restaurant&quot;</span>: {
      <span class="hljs-string">&quot;properties&quot;</span>: {
        <span class="hljs-string">&quot;name&quot;</span>: {
          <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>
        },
        <span class="hljs-string">&quot;location&quot;</span>: {
          <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;geo_point&quot;</span>
        }
      }
    }
  }
}
</code></pre>
<h3 id="&#x7ECF;&#x7EAC;&#x5EA6;&#x5750;&#x6807;&#x683C;&#x5F0F;"><a name="&#x7ECF;&#x7EAC;&#x5EA6;&#x5750;&#x6807;&#x683C;&#x5F0F;" class="anchor-navigation-ex-anchor" href="#&#x7ECF;&#x7EAC;&#x5EA6;&#x5750;&#x6807;&#x683C;&#x5F0F;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x7ECF;&#x7EAC;&#x5EA6;&#x5750;&#x6807;&#x683C;&#x5F0F;</h3>
<p>&#x5982;&#x4E0A;&#x4F8B;&#xFF0C;<code>location</code> &#x5B57;&#x6BB5;&#x88AB;&#x58F0;&#x660E;&#x4E3A; <code>geo_point</code> &#x540E;&#xFF0C;&#x6211;&#x4EEC;&#x5C31;&#x53EF;&#x4EE5;&#x7D22;&#x5F15;&#x5305;&#x542B;&#x4E86;&#x7ECF;&#x7EAC;&#x5EA6;&#x4FE1;&#x606F;&#x7684;&#x6587;&#x6863;&#x4E86;&#x3002; &#x7ECF;&#x7EAC;&#x5EA6;&#x4FE1;&#x606F;&#x7684;&#x5F62;&#x5F0F;&#x53EF;&#x4EE5;&#x662F;&#x5B57;&#x7B26;&#x4E32;&#x3001;&#x6570;&#x7EC4;&#x6216;&#x8005;&#x5BF9;&#x8C61;&#xFF1A;</p>
<pre><code class="lang-json">PUT /attractions/restaurant/<span class="hljs-number">1</span>
{
  <span class="hljs-string">&quot;name&quot;</span>:     <span class="hljs-string">&quot;Chipotle Mexican Grill&quot;</span>,
  <span class="hljs-string">&quot;location&quot;</span>: <span class="hljs-string">&quot;40.715, -74.011&quot;</span>                   &lt;<span class="hljs-number">1</span>&gt;
}

PUT /attractions/restaurant/<span class="hljs-number">2</span>
{
  <span class="hljs-string">&quot;name&quot;</span>:     <span class="hljs-string">&quot;Pala Pizza&quot;</span>,
  <span class="hljs-string">&quot;location&quot;</span>: {                                   &lt;2&gt;
    &quot;lat&quot;:     40.722,
    &quot;lon&quot;:    -73.989
  }
}

PUT /attractions/restaurant/3
{
  &quot;name&quot;:     &quot;Mini Munchies Pizza&quot;,
  &quot;location&quot;: [ -73.983, 40.719 ]                 &lt;3&gt;
}
</code></pre>
<blockquote>
<p> <img src="assets/1.png" alt="img">  &#x5B57;&#x7B26;&#x4E32;&#x5F62;&#x5F0F;&#x4EE5;&#x534A;&#x89D2;&#x9017;&#x53F7;&#x5206;&#x5272;&#xFF0C;&#x5982; <code>&quot;lat,lon&quot;</code> &#x3002; </p>
<p> <img src="assets/2.png" alt="img">  &#x5BF9;&#x8C61;&#x5F62;&#x5F0F;&#x663E;&#x5F0F;&#x547D;&#x540D;&#x4E3A; <code>lat</code> &#x548C; <code>lon</code> &#x3002;    </p>
<p> <img src="assets/3.png" alt="img">  &#x6570;&#x7EC4;&#x5F62;&#x5F0F;&#x8868;&#x793A;&#x4E3A; <code>[lon,lat]</code> &#x3002;           </p>
<p> <img src="assets/caution.png" alt="&#x5C0F;&#x5FC3;">  &#x53EF;&#x80FD;&#x6240;&#x6709;&#x4EBA;&#x90FD;&#x81F3;&#x5C11;&#x4E00;&#x6B21;&#x8E29;&#x8FC7;&#x8FD9;&#x4E2A;&#x5751;&#xFF1A;&#x5730;&#x7406;&#x5750;&#x6807;&#x70B9;&#x7528;&#x5B57;&#x7B26;&#x4E32;&#x5F62;&#x5F0F;&#x8868;&#x793A;&#x65F6;&#x662F;&#x7EAC;&#x5EA6;&#x5728;&#x524D;&#xFF0C;&#x7ECF;&#x5EA6;&#x5728;&#x540E;&#xFF08; <code>&quot;latitude,longitude&quot;</code> &#xFF09;&#xFF0C;&#x800C;&#x6570;&#x7EC4;&#x5F62;&#x5F0F;&#x8868;&#x793A;&#x65F6;&#x662F;&#x7ECF;&#x5EA6;&#x5728;&#x524D;&#xFF0C;&#x7EAC;&#x5EA6;&#x5728;&#x540E;&#xFF08; <code>[longitude,latitude]</code> &#xFF09;&#x2014;&#x987A;&#x5E8F;&#x521A;&#x597D;&#x76F8;&#x53CD;&#x3002;  </p>
</blockquote>
<p>&#x5176;&#x5B9E;&#xFF0C;&#x5728; Elasticesearch &#x5185;&#x90E8;&#xFF0C;&#x4E0D;&#x7BA1;&#x5B57;&#x7B26;&#x4E32;&#x5F62;&#x5F0F;&#x8FD8;&#x662F;&#x6570;&#x7EC4;&#x5F62;&#x5F0F;&#xFF0C;&#x90FD;&#x662F;&#x7ECF;&#x5EA6;&#x5728;&#x524D;&#xFF0C;&#x7EAC;&#x5EA6;&#x5728;&#x540E;&#x3002;&#x4E0D;&#x8FC7;&#x65E9;&#x671F;&#x4E3A;&#x4E86;&#x9002;&#x914D; GeoJSON &#x7684;&#x683C;&#x5F0F;&#x89C4;&#x8303;&#xFF0C;&#x8C03;&#x6574;&#x4E86;&#x6570;&#x7EC4;&#x5F62;&#x5F0F;&#x7684;&#x8868;&#x793A;&#x65B9;&#x5F0F;&#x3002;</p>
<p>&#x56E0;&#x6B64;&#xFF0C;&#x5728;&#x4F7F;&#x7528;&#x5730;&#x7406;&#x4F4D;&#x7F6E;&#x7684;&#x8DEF;&#x4E0A;&#x5C31;&#x51FA;&#x73B0;&#x4E86;&#x8FD9;&#x4E48;&#x4E00;&#x4E2A;&#x201C;&#x6355;&#x718A;&#x5668;&#x201D;&#xFF0C;&#x4E13;&#x5751;&#x90A3;&#x4E9B;&#x4E0D;&#x4E86;&#x89E3;&#x8FD9;&#x4E2A;&#x9677;&#x9631;&#x7684;&#x4F7F;&#x7528;&#x8005;&#x3002;</p>
<h3 id="&#x901A;&#x8FC7;&#x5730;&#x7406;&#x5750;&#x6807;&#x70B9;&#x8FC7;&#x6EE4;"><a name="&#x901A;&#x8FC7;&#x5730;&#x7406;&#x5750;&#x6807;&#x70B9;&#x8FC7;&#x6EE4;" class="anchor-navigation-ex-anchor" href="#&#x901A;&#x8FC7;&#x5730;&#x7406;&#x5750;&#x6807;&#x70B9;&#x8FC7;&#x6EE4;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x901A;&#x8FC7;&#x5730;&#x7406;&#x5750;&#x6807;&#x70B9;&#x8FC7;&#x6EE4;</h3>
<p>&#x6709;&#x56DB;&#x79CD;&#x5730;&#x7406;&#x5750;&#x6807;&#x70B9;&#x76F8;&#x5173;&#x7684;&#x8FC7;&#x6EE4;&#x5668; &#x53EF;&#x4EE5;&#x7528;&#x6765;&#x9009;&#x4E2D;&#x6216;&#x8005;&#x6392;&#x9664;&#x6587;&#x6863;&#xFF1A;</p>
<ul>
<li><p><a href="https://www.elastic.co/guide/cn/elasticsearch/guide/current/geo-bounding-box.html" target="_blank"><code>geo_bounding_box</code></a></p>
<p>&#x627E;&#x51FA;&#x843D;&#x5728;&#x6307;&#x5B9A;&#x77E9;&#x5F62;&#x6846;&#x4E2D;&#x7684;&#x70B9;&#x3002;</p>
</li>
<li><p><a href="https://www.elastic.co/guide/cn/elasticsearch/guide/current/geo-distance.html" target="_blank"><code>geo_distance</code></a></p>
<p>&#x627E;&#x51FA;&#x4E0E;&#x6307;&#x5B9A;&#x4F4D;&#x7F6E;&#x5728;&#x7ED9;&#x5B9A;&#x8DDD;&#x79BB;&#x5185;&#x7684;&#x70B9;&#x3002;</p>
</li>
<li><p><a href="https://www.elastic.co/guide/cn/elasticsearch/guide/current/geo-distance.html#geo-distance-range" target="_blank"><code>geo_distance_range</code></a></p>
<p>&#x627E;&#x51FA;&#x4E0E;&#x6307;&#x5B9A;&#x70B9;&#x8DDD;&#x79BB;&#x5728;&#x7ED9;&#x5B9A;&#x6700;&#x5C0F;&#x8DDD;&#x79BB;&#x548C;&#x6700;&#x5927;&#x8DDD;&#x79BB;&#x4E4B;&#x95F4;&#x7684;&#x70B9;&#x3002;</p>
</li>
<li><p><code>geo_polygon</code></p>
<p>&#x627E;&#x51FA;&#x843D;&#x5728;&#x591A;&#x8FB9;&#x5F62;&#x4E2D;&#x7684;&#x70B9;&#x3002; <em>&#x8FD9;&#x4E2A;&#x8FC7;&#x6EE4;&#x5668;&#x4F7F;&#x7528;&#x4EE3;&#x4EF7;&#x5F88;&#x5927;</em> &#x3002;&#x5F53;&#x4F60;&#x89C9;&#x5F97;&#x81EA;&#x5DF1;&#x9700;&#x8981;&#x4F7F;&#x7528;&#x5B83;&#xFF0C;&#x6700;&#x597D;&#x5148;&#x770B;&#x770B; <a href="https://www.elastic.co/guide/cn/elasticsearch/guide/current/geo-shapes.html" target="_blank">geo-shapes</a>&#x3002;</p>
</li>
</ul>
<p>&#x8FD9;&#x4E9B;&#x8FC7;&#x6EE4;&#x5668;&#x5224;&#x65AD;&#x70B9;&#x662F;&#x5426;&#x843D;&#x5728;&#x6307;&#x5B9A;&#x533A;&#x57DF;&#x65F6;&#x7684;&#x8BA1;&#x7B97;&#x65B9;&#x6CD5;&#x7A0D;&#x6709;&#x4E0D;&#x540C;&#xFF0C;&#x4F46;&#x8FC7;&#x7A0B;&#x7C7B;&#x4F3C;&#x3002;&#x6307;&#x5B9A;&#x7684;&#x533A;&#x57DF;&#x88AB;&#x8F6C;&#x6362;&#x6210;&#x4E00;&#x7CFB;&#x5217;&#x4EE5;quad/geohash&#x4E3A;&#x524D;&#x7F00;&#x7684;tokens&#xFF0C;&#x5E76;&#x88AB;&#x7528;&#x6765;&#x5728;&#x5012;&#x6392;&#x7D22;&#x5F15;&#x4E2D;&#x641C;&#x7D22;&#x62E5;&#x6709;&#x76F8;&#x540C;tokens&#x7684;&#x6587;&#x6863;&#x3002;</p>
<blockquote>
<p> <img src="assets/tip.png" alt="&#x63D0;&#x793A;">  &#x5730;&#x7406;&#x5750;&#x6807;&#x8FC7;&#x6EE4;&#x5668;&#x4F7F;&#x7528;&#x4EE3;&#x4EF7;&#x6602;&#x8D35;&#x2009;&#x2014;&#x2009;&#x6240;&#x4EE5;&#x6700;&#x597D;&#x5728;&#x6587;&#x6863;&#x96C6;&#x5408;&#x5C3D;&#x53EF;&#x80FD;&#x5C11;&#x7684;&#x573A;&#x666F;&#x4E0B;&#x4F7F;&#x7528;&#x3002;&#x4F60;&#x53EF;&#x4EE5;&#x5148;&#x4F7F;&#x7528;&#x90A3;&#x4E9B;&#x7B80;&#x5355;&#x5FEB;&#x6377;&#x7684;&#x8FC7;&#x6EE4;&#x5668;&#xFF0C;&#x6BD4;&#x5982; <code>term</code> &#x6216; <code>range</code> &#xFF0C;&#x6765;&#x8FC7;&#x6EE4;&#x6389;&#x5C3D;&#x53EF;&#x80FD;&#x591A;&#x7684;&#x6587;&#x6863;&#xFF0C;&#x6700;&#x540E;&#x624D;&#x4EA4;&#x7ED9;&#x5730;&#x7406;&#x5750;&#x6807;&#x8FC7;&#x6EE4;&#x5668;&#x5904;&#x7406;&#x3002;  </p>
</blockquote>
<p>&#x5E03;&#x5C14;&#x578B;&#x8FC7;&#x6EE4;&#x5668; <a href="https://www.elastic.co/guide/cn/elasticsearch/guide/current/combining-filters.html#bool-filter" target="_blank"><code>bool</code> filter</a> &#x4F1A;&#x81EA;&#x52A8;&#x5E2E;&#x4F60;&#x505A;&#x8FD9;&#x4EF6;&#x4E8B;&#x3002; &#x5B83;&#x4F1A;&#x4F18;&#x5148;&#x8BA9;&#x90A3;&#x4E9B;&#x57FA;&#x4E8E;&#x201C;bitset&#x201D;&#x7684;&#x7B80;&#x5355;&#x8FC7;&#x6EE4;&#x5668;(&#x89C1; <a href="https://www.elastic.co/guide/cn/elasticsearch/guide/current/filter-caching.html" target="_blank">&#x5173;&#x4E8E;&#x7F13;&#x5B58;</a> )&#x6765;&#x8FC7;&#x6EE4;&#x6389;&#x5C3D;&#x53EF;&#x80FD;&#x591A;&#x7684;&#x6587;&#x6863;&#xFF0C;&#x7136;&#x540E;&#x4F9D;&#x6B21;&#x624D;&#x662F;&#x66F4;&#x6602;&#x8D35;&#x7684;&#x5730;&#x7406;&#x5750;&#x6807;&#x8FC7;&#x6EE4;&#x5668;&#x6216;&#x8005;&#x811A;&#x672C;&#x7C7B;&#x7684;&#x8FC7;&#x6EE4;&#x5668;&#x3002;</p>
<h3 id="&#x5730;&#x7406;&#x5750;&#x6807;&#x76D2;&#x6A21;&#x578B;&#x8FC7;&#x6EE4;&#x5668;"><a name="&#x5730;&#x7406;&#x5750;&#x6807;&#x76D2;&#x6A21;&#x578B;&#x8FC7;&#x6EE4;&#x5668;" class="anchor-navigation-ex-anchor" href="#&#x5730;&#x7406;&#x5750;&#x6807;&#x76D2;&#x6A21;&#x578B;&#x8FC7;&#x6EE4;&#x5668;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5730;&#x7406;&#x5750;&#x6807;&#x76D2;&#x6A21;&#x578B;&#x8FC7;&#x6EE4;&#x5668;</h3>
<p>&#x8FD9;&#x662F;&#x76EE;&#x524D;&#x4E3A;&#x6B62;&#x6700;&#x6709;&#x6548;&#x7684;&#x5730;&#x7406;&#x5750;&#x6807;&#x8FC7;&#x6EE4;&#x5668;&#x4E86;&#xFF0C;&#x56E0;&#x4E3A;&#x5B83;&#x8BA1;&#x7B97;&#x8D77;&#x6765;&#x975E;&#x5E38;&#x7B80;&#x5355;&#x3002; &#x4F60;&#x6307;&#x5B9A;&#x4E00;&#x4E2A;&#x77E9;&#x5F62;&#x7684; <code>&#x9876;&#x90E8;</code> , <code>&#x5E95;&#x90E8;</code> , <code>&#x5DE6;&#x8FB9;&#x754C;</code> &#xFF0C;&#x548C; <code>&#x53F3;&#x8FB9;&#x754C;</code> &#xFF0C;&#x7136;&#x540E;&#x8FC7;&#x6EE4;&#x5668;&#x53EA;&#x9700;&#x5224;&#x65AD;&#x5750;&#x6807;&#x7684;&#x7ECF;&#x5EA6;&#x662F;&#x5426;&#x5728;&#x5DE6;&#x53F3;&#x8FB9;&#x754C;&#x4E4B;&#x95F4;&#xFF0C;&#x7EAC;&#x5EA6;&#x662F;&#x5426;&#x5728;&#x4E0A;&#x4E0B;&#x8FB9;&#x754C;&#x4E4B;&#x95F4;&#xFF1A;</p>
<pre><code class="lang-json">GET /attractions/restaurant/_search
{
  <span class="hljs-string">&quot;query&quot;</span>: {
    <span class="hljs-string">&quot;filtered&quot;</span>: {
      <span class="hljs-string">&quot;filter&quot;</span>: {
        <span class="hljs-string">&quot;geo_bounding_box&quot;</span>: {
          <span class="hljs-string">&quot;location&quot;</span>: {               <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">1</span>&gt;</span>
            &quot;top_left&quot;: {
              &quot;lat&quot;:  40.8,
              &quot;lon&quot;: -74.0
            },
            &quot;bottom_right&quot;: {
              &quot;lat&quot;:  40.7,
              &quot;lon&quot;: -73.0
            }
          }
        }
      }
    }
  }
}
</span></code></pre>
<blockquote>
<p> <img src="assets/1.png" alt="img">  &#x8FD9;&#x4E9B;&#x5750;&#x6807;&#x4E5F;&#x53EF;&#x4EE5;&#x7528; <code>bottom_left</code> &#x548C; <code>top_right</code> &#x6765;&#x8868;&#x793A;&#x3002;   </p>
</blockquote>
<p><strong>&#x4F18;&#x5316;&#x76D2;&#x6A21;&#x578B;</strong></p>
<p><code>&#x5730;&#x7406;&#x5750;&#x6807;&#x76D2;&#x6A21;&#x578B;&#x8FC7;&#x6EE4;&#x5668;</code> &#x4E0D;&#x9700;&#x8981;&#x628A;&#x6240;&#x6709;&#x5750;&#x6807;&#x70B9;&#x90FD;&#x52A0;&#x8F7D;&#x5230;&#x5185;&#x5B58;&#x91CC;&#x3002; &#x56E0;&#x4E3A;&#x5B83;&#x8981;&#x505A;&#x7684; &#x53EA;&#x662F;&#x7B80;&#x5355;&#x5224;&#x65AD; <code>lat</code> &#x548C; <code>lon</code> &#x5750;&#x6807;&#x6570;&#x503C;&#x662F;&#x5426;&#x5728;&#x7ED9;&#x5B9A;&#x7684;&#x8303;&#x56F4;&#x5185;&#xFF0C;&#x53EF;&#x4EE5;&#x7528;&#x5012;&#x6392;&#x7D22;&#x5F15;&#x505A;&#x4E00;&#x4E2A; <code>range</code> &#x8FC7;&#x6EE4;&#x6765;&#x5B9E;&#x73B0;&#x76EE;&#x6807;&#x3002;</p>
<p>&#x8981;&#x4F7F;&#x7528;&#x8FD9;&#x79CD;&#x4F18;&#x5316;&#x65B9;&#x5F0F;&#xFF0C;&#x9700;&#x8981;&#x628A; <code>geo_point</code> &#x5B57;&#x6BB5; &#x7528; <code>lat</code> &#x548C; <code>lon</code> &#x7684;&#x65B9;&#x5F0F;&#x5206;&#x522B;&#x6620;&#x5C04;&#x5230;&#x7D22;&#x5F15;&#x4E2D;&#xFF1A;</p>
<pre><code class="lang-json">PUT /attractions
{
  <span class="hljs-string">&quot;mappings&quot;</span>: {
    <span class="hljs-string">&quot;restaurant&quot;</span>: {
      <span class="hljs-string">&quot;properties&quot;</span>: {
        <span class="hljs-string">&quot;name&quot;</span>: {
          <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>
        },
        <span class="hljs-string">&quot;location&quot;</span>: {
          <span class="hljs-string">&quot;type&quot;</span>:    <span class="hljs-string">&quot;geo_point&quot;</span>,
          <span class="hljs-string">&quot;lat_lon&quot;</span>: <span class="hljs-literal">true</span>                &lt;<span class="hljs-number">1</span>&gt;
        }
      }
    }
  }
}
</code></pre>
<blockquote>
<p> <img src="assets/1.png" alt="img">  <code>location.lat</code> &#x548C; <code>location.lon</code> &#x5B57;&#x6BB5;&#x5C06;&#x88AB;&#x5206;&#x522B;&#x7D22;&#x5F15;&#x3002;&#x5B83;&#x4EEC;&#x53EF;&#x4EE5;&#x88AB;&#x7528;&#x4E8E;&#x68C0;&#x7D22;&#xFF0C;&#x4F46;&#x662F;&#x4E0D;&#x4F1A;&#x5728;&#x68C0;&#x7D22;&#x7ED3;&#x679C;&#x4E2D;&#x8FD4;&#x56DE;&#x3002;   </p>
</blockquote>
<p>&#x7136;&#x540E;&#xFF0C;&#x67E5;&#x8BE2;&#x65F6;&#x4F60;&#x9700;&#x8981;&#x544A;&#x8BC9; Elasticesearch &#x4F7F;&#x7528;&#x5DF2;&#x7D22;&#x5F15;&#x7684; <code>lat</code> &#x548C; <code>lon</code> &#xFF1A;</p>
<pre><code class="lang-json">GET /attractions/restaurant/_search
{
  <span class="hljs-string">&quot;query&quot;</span>: {
    <span class="hljs-string">&quot;filtered&quot;</span>: {
      <span class="hljs-string">&quot;filter&quot;</span>: {
        <span class="hljs-string">&quot;geo_bounding_box&quot;</span>: {
          <span class="hljs-string">&quot;type&quot;</span>:    <span class="hljs-string">&quot;indexed&quot;</span>,              <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">1</span>&gt;</span>
          &quot;location&quot;: {
            &quot;top_left&quot;: {
              &quot;lat&quot;:  40.8,
              &quot;lon&quot;: -74.0
            },
            &quot;bottom_right&quot;: {
              &quot;lat&quot;:  40.7,
              &quot;lon&quot;:  -73.0
            }
          }
        }
      }
    }
  }
}
</span></code></pre>
<blockquote>
<p> <img src="assets/1.png" alt="img">  &#x8BBE;&#x7F6E; <code>type</code> &#x53C2;&#x6570;&#x4E3A; <code>indexed</code> &#xFF08;&#x66FF;&#x4EE3;&#x9ED8;&#x8BA4;&#x503C; <code>memory</code> &#xFF09;&#x6765;&#x660E;&#x786E;&#x544A;&#x8BC9; Elasticsearch &#x5BF9;&#x8FD9;&#x4E2A;&#x8FC7;&#x6EE4;&#x5668;&#x4F7F;&#x7528;&#x5012;&#x6392;&#x7D22;&#x5F15;&#x3002;   </p>
<p> <img src="assets/caution.png" alt="&#x5C0F;&#x5FC3;">  <code>geo_point</code> &#x7C7B;&#x578B;&#x7684;&#x5B57;&#x6BB5;&#x53EF;&#x4EE5;&#x5305;&#x542B;&#x591A;&#x4E2A;&#x5730;&#x7406;&#x5750;&#x6807;&#x70B9;&#xFF0C;&#x4F46;&#x662F;&#x9488;&#x5BF9;&#x7ECF;&#x5EA6;&#x7EAC;&#x5EA6;&#x5206;&#x522B;&#x7D22;&#x5F15;&#x7684;&#x8FD9;&#x79CD;&#x4F18;&#x5316;&#x65B9;&#x5F0F;&#x53EA;&#x5BF9;&#x5305;&#x542B;&#x5355;&#x4E2A;&#x5750;&#x6807;&#x70B9;&#x7684;&#x5B57;&#x6BB5;&#x6709;&#x6548;&#x3002;</p>
</blockquote>
<h3 id="&#x5730;&#x7406;&#x8DDD;&#x79BB;&#x8FC7;&#x6EE4;&#x5668;"><a name="&#x5730;&#x7406;&#x8DDD;&#x79BB;&#x8FC7;&#x6EE4;&#x5668;" class="anchor-navigation-ex-anchor" href="#&#x5730;&#x7406;&#x8DDD;&#x79BB;&#x8FC7;&#x6EE4;&#x5668;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5730;&#x7406;&#x8DDD;&#x79BB;&#x8FC7;&#x6EE4;&#x5668;</h3>
<p>&#x5730;&#x7406;&#x8DDD;&#x79BB;&#x8FC7;&#x6EE4;&#x5668;&#xFF08; <code>geo_distance</code> &#xFF09;&#x4EE5;&#x7ED9;&#x5B9A;&#x4F4D;&#x7F6E;&#x4E3A;&#x5706;&#x5FC3;&#x753B;&#x4E00;&#x4E2A;&#x5706;&#xFF0C;&#x6765;&#x627E;&#x51FA;&#x90A3;&#x4E9B;&#x5730;&#x7406;&#x5750;&#x6807;&#x843D;&#x5728;&#x5176;&#x4E2D;&#x7684;&#x6587;&#x6863; &#xFF1A;</p>
<pre><code class="lang-json">GET /attractions/restaurant/_search
{
  <span class="hljs-string">&quot;query&quot;</span>: {
    <span class="hljs-string">&quot;filtered&quot;</span>: {
      <span class="hljs-string">&quot;filter&quot;</span>: {
        <span class="hljs-string">&quot;geo_distance&quot;</span>: {
          <span class="hljs-string">&quot;distance&quot;</span>: <span class="hljs-string">&quot;1km&quot;</span>,        &lt;1&gt;
          &quot;location&quot;: {             &lt;2&gt;
            &quot;lat&quot;:  40.715,
            &quot;lon&quot;: -73.988
          }
        }
      }
    }
  }
}
</code></pre>
<blockquote>
<p> <img src="assets/1.png" alt="img">  &#x627E;&#x51FA;&#x6240;&#x6709;&#x4E0E;&#x6307;&#x5B9A;&#x70B9;&#x8DDD;&#x79BB;&#x5728; <code>1km</code> &#x5185;&#x7684; <code>location</code> &#x5B57;&#x6BB5;&#x3002;&#x8BBF;&#x95EE; <a href="https://www.elastic.co/guide/en/elasticsearch/reference/5.6/common-options.html#distance-units" target="_blank">Distance Units</a> &#x67E5;&#x770B;&#x6240;&#x652F;&#x6301;&#x7684;&#x8DDD;&#x79BB;&#x8868;&#x793A;&#x5355;&#x4F4D;&#x3002;   </p>
<p> <img src="assets/2.png" alt="img">  &#x4E2D;&#x5FC3;&#x70B9;&#x53EF;&#x4EE5;&#x8868;&#x793A;&#x4E3A;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x6570;&#x7EC4;&#x6216;&#x8005;&#xFF08;&#x5982;&#x793A;&#x4F8B;&#x4E2D;&#x7684;&#xFF09;&#x5BF9;&#x8C61;&#x3002;&#x8BE6;&#x89C1; <a href="https://www.elastic.co/guide/cn/elasticsearch/guide/current/lat-lon-formats.html" target="_blank">&#x7ECF;&#x7EAC;&#x5EA6;&#x5750;&#x6807;&#x683C;&#x5F0F;</a>&#x3002; </p>
</blockquote>
<p>&#x5730;&#x7406;&#x8DDD;&#x79BB;&#x8FC7;&#x6EE4;&#x5668;&#x8BA1;&#x7B97;&#x4EE3;&#x4EF7;&#x6602;&#x8D35;&#x3002;&#x4E3A;&#x4E86;&#x4F18;&#x5316;&#x6027;&#x80FD;&#xFF0C;Elasticsearch &#x5148;&#x753B;&#x4E00;&#x4E2A;&#x77E9;&#x5F62;&#x6846;&#x6765;&#x56F4;&#x4F4F;&#x6574;&#x4E2A;&#x5706;&#x5F62;&#xFF0C;&#x8FD9;&#x6837;&#x5C31;&#x53EF;&#x4EE5;&#x5148;&#x7528;&#x6D88;&#x8017;&#x8F83;&#x5C11;&#x7684;&#x76D2;&#x6A21;&#x578B;&#x8BA1;&#x7B97;&#x65B9;&#x5F0F;&#x6765;&#x6392;&#x9664;&#x6389;&#x5C3D;&#x53EF;&#x80FD;&#x591A;&#x7684;&#x6587;&#x6863;&#x3002; &#x7136;&#x540E;&#x53EA;&#x5BF9;&#x843D;&#x5728;&#x76D2;&#x6A21;&#x578B;&#x5185;&#x7684;&#x8FD9;&#x90E8;&#x5206;&#x70B9;&#x7528;&#x5730;&#x7406;&#x8DDD;&#x79BB;&#x8BA1;&#x7B97;&#x65B9;&#x5F0F;&#x5904;&#x7406;&#x3002;</p>
<blockquote>
<p> <img src="assets/tip.png" alt="&#x63D0;&#x793A;">  &#x4F60;&#x9700;&#x8981;&#x5224;&#x65AD;&#x4F60;&#x7684;&#x7528;&#x6237;&#xFF0C;&#x662F;&#x5426;&#x9700;&#x8981;&#x5982;&#x6B64;&#x7CBE;&#x786E;&#x7684;&#x4F7F;&#x7528;&#x5706;&#x6A21;&#x578B;&#x6765;&#x505A;&#x8DDD;&#x79BB;&#x8FC7;&#x6EE4;&#xFF1F; &#x901A;&#x5E38;&#x4F7F;&#x7528;&#x77E9;&#x5F62;&#x6A21;&#x578B; <a href="https://www.elastic.co/guide/cn/elasticsearch/guide/current/geo-bounding-box.html" target="_blank">bounding box</a> &#x662F;&#x6BD4;&#x5730;&#x7406;&#x8DDD;&#x79BB;&#x66F4;&#x9AD8;&#x6548;&#x7684;&#x65B9;&#x5F0F;&#xFF0C;&#x5E76;&#x4E14;&#x5F80;&#x5F80;&#x4E5F;&#x80FD;&#x6EE1;&#x8DB3;&#x5E94;&#x7528;&#x9700;&#x6C42;&#x3002;  </p>
</blockquote>
<p><strong>&#x66F4;&#x5FEB;&#x7684;&#x5730;&#x7406;&#x8DDD;&#x79BB;&#x8BA1;&#x7B97;</strong></p>
<p>&#x4E24;&#x70B9;&#x95F4;&#x7684;&#x8DDD;&#x79BB;&#x8BA1;&#x7B97;&#xFF0C;&#x6709;&#x591A;&#x79CD;&#x727A;&#x7272;&#x6027;&#x80FD;&#x6362;&#x53D6;&#x7CBE;&#x5EA6;&#x7684;&#x7B97;&#x6CD5;&#xFF1A;</p>
<ul>
<li><p><code>arc</code></p>
<p>&#x6700;&#x6162;&#x4F46;&#x6700;&#x7CBE;&#x786E;&#x7684;&#x662F; <code>arc</code> &#x8BA1;&#x7B97;&#x65B9;&#x5F0F;&#xFF0C;&#x8FD9;&#x79CD;&#x65B9;&#x5F0F;&#x628A;&#x4E16;&#x754C;&#x5F53;&#x4F5C;&#x7403;&#x4F53;&#x6765;&#x5904;&#x7406;&#x3002;&#x4E0D;&#x8FC7;&#x8FD9;&#x79CD;&#x65B9;&#x5F0F;&#x7684;&#x7CBE;&#x5EA6;&#x6709;&#x9650;&#xFF0C;&#x56E0;&#x4E3A;&#x8FD9;&#x4E2A;&#x4E16;&#x754C;&#x5E76;&#x4E0D;&#x662F;&#x5B8C;&#x5168;&#x7684;&#x7403;&#x4F53;&#x3002;</p>
</li>
<li><p><code>plane</code></p>
<p><code>plane</code> &#x8BA1;&#x7B97;&#x65B9;&#x5F0F;&#x628A;&#x5730;&#x7403;&#x5F53;&#x6210;&#x662F;&#x5E73;&#x5766;&#x7684;&#xFF0C;&#x8FD9;&#x79CD;&#x65B9;&#x5F0F;&#x5FEB;&#x4E00;&#x4E9B;&#x4F46;&#x662F;&#x7CBE;&#x5EA6;&#x7565;&#x900A;&#x3002;&#x5728;&#x8D64;&#x9053;&#x9644;&#x8FD1;&#x7684;&#x4F4D;&#x7F6E;&#x7CBE;&#x5EA6;&#x6700;&#x597D;&#xFF0C;&#x800C;&#x9760;&#x8FD1;&#x4E24;&#x6781;&#x5219;&#x53D8;&#x5DEE;&#x3002;</p>
</li>
<li><p><code>sloppy_arc</code></p>
<p>&#x5982;&#x6B64;&#x547D;&#x540D;&#xFF0C;&#x662F;&#x56E0;&#x4E3A;&#x5B83;&#x4F7F;&#x7528;&#x4E86; Lucene &#x7684; <code>SloppyMath</code> &#x7C7B;&#x3002;&#x8FD9;&#x662F;&#x4E00;&#x79CD;&#x7528;&#x7CBE;&#x5EA6;&#x6362;&#x53D6;&#x901F;&#x5EA6;&#x7684;&#x8BA1;&#x7B97;&#x65B9;&#x5F0F;&#xFF0C; &#x5B83;&#x4F7F;&#x7528; <a href="http://en.wikipedia.org/wiki/Haversine_formula" target="_blank">Haversine formula</a> &#x6765;&#x8BA1;&#x7B97;&#x8DDD;&#x79BB;&#x3002;&#x5B83;&#x6BD4; <code>arc</code> &#x8BA1;&#x7B97;&#x65B9;&#x5F0F;&#x5FEB; 4 &#x5230; 5 &#x500D;&#xFF0C;&#x5E76;&#x4E14;&#x8DDD;&#x79BB;&#x7CBE;&#x5EA6;&#x8FBE; 99.9%&#x3002;&#x8FD9;&#x4E5F;&#x662F;&#x9ED8;&#x8BA4;&#x7684;&#x8BA1;&#x7B97;&#x65B9;&#x5F0F;&#x3002;</p>
</li>
</ul>
<p>&#x4F60;&#x53EF;&#x4EE5;&#x53C2;&#x8003;&#x4E0B;&#x4F8B;&#x6765;&#x6307;&#x5B9A;&#x4E0D;&#x540C;&#x7684;&#x8BA1;&#x7B97;&#x65B9;&#x5F0F;&#xFF1A;</p>
<pre><code class="lang-json">GET /attractions/restaurant/_search
{
  <span class="hljs-string">&quot;query&quot;</span>: {
    <span class="hljs-string">&quot;filtered&quot;</span>: {
      <span class="hljs-string">&quot;filter&quot;</span>: {
        <span class="hljs-string">&quot;geo_distance&quot;</span>: {
          <span class="hljs-string">&quot;distance&quot;</span>:      <span class="hljs-string">&quot;1km&quot;</span>,
          <span class="hljs-string">&quot;distance_type&quot;</span>: <span class="hljs-string">&quot;plane&quot;</span>,       <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">1</span>&gt;</span>
          &quot;location&quot;: {
            &quot;lat&quot;:  40.715,
            &quot;lon&quot;: -73.988
          }
        }
      }
    }
  }
}
</span></code></pre>
<blockquote>
<p> <img src="assets/1.png" alt="img">  &#x4F7F;&#x7528;&#x66F4;&#x5FEB;&#x4F46;&#x7CBE;&#x5EA6;&#x7A0D;&#x5DEE;&#x7684; <code>plane</code> &#x8BA1;&#x7B97;&#x65B9;&#x6CD5;&#x3002;   </p>
<p> <img src="assets/tip.png" alt="&#x63D0;&#x793A;">  &#x4F60;&#x7684;&#x7528;&#x6237;&#x771F;&#x7684;&#x4F1A;&#x5728;&#x610F;&#x4E00;&#x4E2A;&#x9910;&#x9986;&#x843D;&#x5728;&#x6307;&#x5B9A;&#x5706;&#x5F62;&#x533A;&#x57DF;&#x6570;&#x7C73;&#x4E4B;&#x5916;&#x5417;&#xFF1F;&#x4E00;&#x4E9B;&#x5730;&#x7406;&#x4F4D;&#x7F6E;&#x76F8;&#x5173;&#x7684;&#x5E94;&#x7528;&#x4F1A;&#x6709;&#x8F83;&#x9AD8;&#x7684;&#x7CBE;&#x5EA6;&#x8981;&#x6C42;&#xFF1B;&#x4F46;&#x5927;&#x90E8;&#x5206;&#x5B9E;&#x9645;&#x5E94;&#x7528;&#x573A;&#x666F;&#x4E2D;&#xFF0C;&#x4F7F;&#x7528;&#x7CBE;&#x5EA6;&#x8F83;&#x4F4E;&#x4F46;&#x54CD;&#x5E94;&#x66F4;&#x5FEB;&#x7684;&#x8BA1;&#x7B97;&#x65B9;&#x5F0F;&#x53EF;&#x80FD;&#x66F4;&#x597D;&#x3002;  </p>
</blockquote>
<p><strong>&#x5730;&#x7406;&#x8DDD;&#x79BB;&#x533A;&#x95F4;&#x8FC7;&#x6EE4;&#x5668;</strong></p>
<p><code>geo_distance</code> &#x548C; <code>geo_distance_range</code> &#x8FC7;&#x6EE4;&#x5668; &#x7684;&#x552F;&#x4E00;&#x5DEE;&#x522B;&#x5728;&#x4E8E;&#x540E;&#x8005;&#x662F;&#x4E00;&#x4E2A;&#x73AF;&#x72B6;&#x7684;&#xFF0C;&#x5B83;&#x4F1A;&#x6392;&#x9664;&#x6389;&#x843D;&#x5728;&#x5185;&#x5708;&#x4E2D;&#x7684;&#x90A3;&#x90E8;&#x5206;&#x6587;&#x6863;&#x3002;</p>
<p>&#x6307;&#x5B9A;&#x5230;&#x4E2D;&#x5FC3;&#x70B9;&#x7684;&#x8DDD;&#x79BB;&#x4E5F;&#x53EF;&#x4EE5;&#x6362;&#x4E00;&#x79CD;&#x8868;&#x793A;&#x65B9;&#x5F0F;&#xFF1A;&#x6307;&#x5B9A;&#x4E00;&#x4E2A;&#x6700;&#x5C0F;&#x8DDD;&#x79BB;&#xFF08;&#x4F7F;&#x7528; <code>gt</code> &#x6216;&#x8005; <code>gte</code> &#xFF09;&#x548C;&#x6700;&#x5927;&#x8DDD;&#x79BB;&#xFF08;&#x4F7F;&#x7528; <code>lt</code> &#x548C; <code>lte</code> &#xFF09;&#xFF0C;&#x5C31;&#x50CF;&#x4F7F;&#x7528; <code>range</code> &#x8FC7;&#x6EE4;&#x5668;&#x4E00;&#x6837;&#xFF1A;</p>
<pre><code class="lang-json">GET /attractions/restaurant/_search
{
  <span class="hljs-string">&quot;query&quot;</span>: {
    <span class="hljs-string">&quot;filtered&quot;</span>: {
      <span class="hljs-string">&quot;filter&quot;</span>: {
        <span class="hljs-string">&quot;geo_distance_range&quot;</span>: {
          <span class="hljs-string">&quot;gte&quot;</span>:    <span class="hljs-string">&quot;1km&quot;</span>,          &lt;1&gt;
          &quot;lt&quot;:     &quot;2km&quot;,          &lt;2&gt;
          &quot;location&quot;: {
            &quot;lat&quot;:  40.715,
            &quot;lon&quot;: -73.988
          }
        }
      }
    }
  }
}
</code></pre>
<blockquote>
<p> <img src="assets/1.png" alt="img">  <img src="assets/2.png" alt="img">  &#x5339;&#x914D;&#x90A3;&#x4E9B;&#x8DDD;&#x79BB;&#x4E2D;&#x5FC3;&#x70B9;&#x5927;&#x4E8E;&#x7B49;&#x4E8E; <code>1km</code> &#x800C;&#x5C0F;&#x4E8E; <code>2km</code> &#x7684;&#x4F4D;&#x7F6E;&#x3002;   </p>
</blockquote>
<h3 id="&#x6309;&#x8DDD;&#x79BB;&#x6392;&#x5E8F;"><a name="&#x6309;&#x8DDD;&#x79BB;&#x6392;&#x5E8F;" class="anchor-navigation-ex-anchor" href="#&#x6309;&#x8DDD;&#x79BB;&#x6392;&#x5E8F;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x6309;&#x8DDD;&#x79BB;&#x6392;&#x5E8F;</h3>
<p>&#x68C0;&#x7D22;&#x7ED3;&#x679C;&#x53EF;&#x4EE5;&#x6309;&#x4E0E;&#x6307;&#x5B9A;&#x70B9;&#x7684;&#x8DDD;&#x79BB;&#x6392;&#x5E8F; &#xFF1A;</p>
<blockquote>
<p> <img src="assets/tip.png" alt="&#x63D0;&#x793A;">  &#x5F53;&#x4F60; <em>&#x53EF;&#x4EE5;</em> &#x6309;&#x8DDD;&#x79BB;&#x6392;&#x5E8F;&#x65F6;&#xFF0C; <a href="https://www.elastic.co/guide/cn/elasticsearch/guide/current/sorting-by-distance.html#scoring-by-distance" target="_blank">&#x6309;&#x8DDD;&#x79BB;&#x6253;&#x5206;</a> &#x901A;&#x5E38;&#x662F;&#x4E00;&#x4E2A;&#x66F4;&#x597D;&#x7684;&#x89E3;&#x51B3;&#x65B9;&#x6848;&#x3002;  </p>
</blockquote>
<pre><code class="lang-json">GET /attractions/restaurant/_search
{
  <span class="hljs-string">&quot;query&quot;</span>: {
    <span class="hljs-string">&quot;filtered&quot;</span>: {
      <span class="hljs-string">&quot;filter&quot;</span>: {
        <span class="hljs-string">&quot;geo_bounding_box&quot;</span>: {
          <span class="hljs-string">&quot;type&quot;</span>:       <span class="hljs-string">&quot;indexed&quot;</span>,
          <span class="hljs-string">&quot;location&quot;</span>: {
            <span class="hljs-string">&quot;top_left&quot;</span>: {
              <span class="hljs-string">&quot;lat&quot;</span>:  <span class="hljs-number">40.8</span>,
              <span class="hljs-string">&quot;lon&quot;</span>: <span class="hljs-number">-74.0</span>
            },
            <span class="hljs-string">&quot;bottom_right&quot;</span>: {
              <span class="hljs-string">&quot;lat&quot;</span>:  <span class="hljs-number">40.4</span>,
              <span class="hljs-string">&quot;lon&quot;</span>: <span class="hljs-number">-73.0</span>
            }
          }
        }
      }
    }
  },
  <span class="hljs-string">&quot;sort&quot;</span>: [
    {
      <span class="hljs-string">&quot;_geo_distance&quot;</span>: {
        <span class="hljs-string">&quot;location&quot;</span>: {                &lt;1&gt;
          &quot;lat&quot;:  40.715,
          &quot;lon&quot;: -73.998
        },
        &quot;order&quot;:         &quot;asc&quot;,
        &quot;unit&quot;:          &quot;km&quot;,       &lt;2&gt;
        &quot;distance_type&quot;: &quot;plane&quot;     &lt;3&gt;
      }
    }
  ]
}
</code></pre>
<blockquote>
<p> <img src="assets/1.png" alt="img">  &#x8BA1;&#x7B97;&#x6BCF;&#x4E2A;&#x6587;&#x6863;&#x4E2D; <code>location</code> &#x5B57;&#x6BB5;&#x4E0E;&#x6307;&#x5B9A;&#x7684; <code>lat/lon</code> &#x70B9;&#x95F4;&#x7684;&#x8DDD;&#x79BB;&#x3002;   </p>
<p> <img src="assets/2.png" alt="img">  &#x5C06;&#x8DDD;&#x79BB;&#x4EE5; <code>km</code> &#x4E3A;&#x5355;&#x4F4D;&#x5199;&#x5165;&#x5230;&#x6BCF;&#x4E2A;&#x8FD4;&#x56DE;&#x7ED3;&#x679C;&#x7684; <code>sort</code> &#x952E;&#x4E2D;&#x3002;  </p>
<p> <img src="assets/3.png" alt="img">  &#x4F7F;&#x7528;&#x5FEB;&#x901F;&#x4F46;&#x7CBE;&#x5EA6;&#x7565;&#x5DEE;&#x7684; <code>plane</code> &#x8BA1;&#x7B97;&#x65B9;&#x5F0F;&#x3002;  </p>
</blockquote>
<p>&#x4F60;&#x53EF;&#x80FD;&#x60F3;&#x95EE;&#xFF1A;&#x4E3A;&#x4EC0;&#x4E48;&#x8981;&#x5236;&#x5B9A;&#x8DDD;&#x79BB;&#x7684; <code>&#x5355;&#x4F4D;</code> &#x5462;&#xFF1F;&#x7528;&#x4E8E;&#x6392;&#x5E8F;&#x7684;&#x8BDD;&#xFF0C;&#x6211;&#x4EEC;&#x5E76;&#x4E0D;&#x5173;&#x5FC3;&#x6BD4;&#x8F83;&#x8DDD;&#x79BB;&#x7684;&#x5C3A;&#x5EA6;&#x662F;&#x82F1;&#x91CC;&#x3001;&#x516C;&#x91CC;&#x8FD8;&#x662F;&#x5149;&#x5E74;&#x3002; &#x539F;&#x56E0;&#x662F;&#xFF0C;&#x8FD9;&#x4E2A;&#x7528;&#x4E8E;&#x6392;&#x5E8F;&#x7684;&#x503C;&#x4F1A;&#x8BBE;&#x7F6E;&#x5728;&#x6BCF;&#x4E2A;&#x8FD4;&#x56DE;&#x7ED3;&#x679C;&#x7684; <code>sort</code> &#x5143;&#x7D20;&#x4E2D;&#x3002;</p>
<pre><code class="lang-json">...
  <span class="hljs-string">&quot;hits&quot;</span>: [
     {
        <span class="hljs-string">&quot;_index&quot;</span>: <span class="hljs-string">&quot;attractions&quot;</span>,
        <span class="hljs-string">&quot;_type&quot;</span>: <span class="hljs-string">&quot;restaurant&quot;</span>,
        <span class="hljs-string">&quot;_id&quot;</span>: <span class="hljs-string">&quot;2&quot;</span>,
        <span class="hljs-string">&quot;_score&quot;</span>: <span class="hljs-literal">null</span>,
        <span class="hljs-string">&quot;_source&quot;</span>: {
           <span class="hljs-string">&quot;name&quot;</span>: <span class="hljs-string">&quot;New Malaysia&quot;</span>,
           <span class="hljs-string">&quot;location&quot;</span>: {
              <span class="hljs-string">&quot;lat&quot;</span>: <span class="hljs-number">40.715</span>,
              <span class="hljs-string">&quot;lon&quot;</span>: <span class="hljs-number">-73.997</span>
           }
        },
        <span class="hljs-string">&quot;sort&quot;</span>: [
           <span class="hljs-number">0.08425653647614346</span>           &lt;<span class="hljs-number">1</span>&gt;
        ]
     },
...
</code></pre>
<blockquote>
<p> <img src="assets/1.png" alt="img">  &#x9910;&#x5385;&#x5230;&#x6211;&#x4EEC;&#x6307;&#x5B9A;&#x7684;&#x4F4D;&#x7F6E;&#x8DDD;&#x79BB;&#x662F; 0.084km&#x3002;  </p>
</blockquote>
<p>&#x4F60;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x8BBE;&#x7F6E; <code>&#x5355;&#x4F4D;</code> &#xFF08; <code>unit</code> &#xFF09;&#x6765;&#x8BA9;&#x8FD4;&#x56DE;&#x503C;&#x7684;&#x5F62;&#x5F0F;&#xFF0C;&#x5339;&#x914D;&#x4F60;&#x5E94;&#x7528;&#x4E2D;&#x9700;&#x8981;&#x7684;&#x3002;</p>
<blockquote>
<p> <img src="assets/tip.png" alt="&#x63D0;&#x793A;">  &#x5730;&#x7406;&#x8DDD;&#x79BB;&#x6392;&#x5E8F;&#x53EF;&#x4EE5;&#x5BF9;&#x591A;&#x4E2A;&#x5750;&#x6807;&#x70B9;&#x6765;&#x4F7F;&#x7528;&#xFF0C;&#x4E0D;&#x7BA1;&#xFF08;&#x8FD9;&#x4E9B;&#x5750;&#x6807;&#x70B9;&#xFF09;&#x662F;&#x5728;&#x6587;&#x6863;&#x4E2D;&#x8FD8;&#x662F;&#x6392;&#x5E8F;&#x53C2;&#x6570;&#x4E2D;&#x3002;&#x4F7F;&#x7528; <code>sort_mode</code> &#x6765;&#x6307;&#x5B9A;&#x662F;&#x5426;&#x9700;&#x8981;&#x4F7F;&#x7528;&#x4F4D;&#x7F6E;&#x96C6;&#x5408;&#x7684; <code>&#x6700;&#x5C0F;</code> &#xFF08; <code>min</code> &#xFF09; <code>&#x6700;&#x5927;</code> &#xFF08; <code>max</code> &#xFF09;&#x6216;&#x8005; <code>&#x5E73;&#x5747;</code>&#xFF08; <code>avg</code> &#xFF09;&#x8DDD;&#x79BB;&#x3002; &#x5982;&#x6B64;&#x5C31;&#x53EF;&#x4EE5;&#x8FD4;&#x56DE; &#x201C;&#x79BB;&#x6211;&#x7684;&#x5DE5;&#x4F5C;&#x5730;&#x548C;&#x5BB6;&#x6700;&#x8FD1;&#x7684;&#x670B;&#x53CB;&#x201D; &#x8FD9;&#x6837;&#x7684;&#x7ED3;&#x679C;&#x4E86;&#x3002;  </p>
</blockquote>
<p><strong>&#x6309;&#x8DDD;&#x79BB;&#x6253;&#x5206;</strong></p>
<p>&#x6709;&#x53EF;&#x80FD;&#x8DDD;&#x79BB;&#x662F;&#x51B3;&#x5B9A;&#x8FD4;&#x56DE;&#x7ED3;&#x679C;&#x6392;&#x5E8F;&#x7684;&#x552F;&#x4E00;&#x91CD;&#x8981;&#x56E0;&#x7D20;&#xFF0C;&#x4E0D;&#x8FC7;&#x66F4;&#x5E38;&#x89C1;&#x7684;&#x60C5;&#x51B5;&#x662F;&#x8DDD;&#x79BB;&#x4F1A;&#x548C;&#x5176;&#x5B83;&#x56E0;&#x7D20;&#xFF0C;&#x6BD4;&#x5982;&#x5168;&#x6587;&#x68C0;&#x7D22;&#x5339;&#x914D;&#x5EA6;&#x3001;&#x6D41;&#x884C;&#x7A0B;&#x5EA6;&#x6216;&#x8005;&#x4EF7;&#x683C;&#x4E00;&#x8D77;&#x51B3;&#x5B9A;&#x6392;&#x5E8F;&#x7ED3;&#x679C;&#x3002;</p>
<p>&#x9047;&#x5230;&#x8FD9;&#x79CD;&#x573A;&#x666F;&#x4F60;&#x9700;&#x8981;&#x5728; <a href="https://www.elastic.co/guide/cn/elasticsearch/guide/current/function-score-query.html" target="_blank">&#x529F;&#x80FD;&#x8BC4;&#x5206;&#x67E5;&#x8BE2;</a> &#x4E2D;&#x6307;&#x5B9A;&#x65B9;&#x5F0F;&#x8BA9;&#x6211;&#x4EEC;&#x628A;&#x8FD9;&#x4E9B;&#x56E0;&#x5B50;&#x5904;&#x7406;&#x540E;&#x5F97;&#x5230;&#x4E00;&#x4E2A;&#x7EFC;&#x5408;&#x5206;&#x3002; <a href="https://www.elastic.co/guide/cn/elasticsearch/guide/current/decay-functions.html" target="_blank">&#x8D8A;&#x8FD1;&#x8D8A;&#x597D;</a> &#x4E2D;&#x6709;&#x4E2A;&#x4E00;&#x4E2A;&#x4F8B;&#x5B50;&#x5C31;&#x662F;&#x4ECB;&#x7ECD;&#x5730;&#x7406;&#x8DDD;&#x79BB;&#x5F71;&#x54CD;&#x6392;&#x5E8F;&#x5F97;&#x5206;&#x7684;&#x3002;</p>
<p>&#x53E6;&#x5916;&#x6309;&#x8DDD;&#x79BB;&#x6392;&#x5E8F;&#x8FD8;&#x6709;&#x4E2A;&#x7F3A;&#x70B9;&#x5C31;&#x662F;&#x6027;&#x80FD;&#xFF1A;&#x9700;&#x8981;&#x5BF9;&#x6BCF;&#x4E00;&#x4E2A;&#x5339;&#x914D;&#x5230;&#x7684;&#x6587;&#x6863;&#x90FD;&#x8FDB;&#x884C;&#x8DDD;&#x79BB;&#x8BA1;&#x7B97;&#x3002;&#x800C; <code>function_score</code> &#x67E5;&#x8BE2;&#xFF0C;&#x5728; <a href="https://www.elastic.co/guide/cn/elasticsearch/guide/current/_Improving_Performance.html#rescore-api" target="_blank"><code>rescore</code> &#x8BED;&#x53E5;</a> &#x4E2D;&#x53EF;&#x4EE5;&#x9650;&#x5236;&#x53EA;&#x5BF9;&#x524D; <em>n</em> &#x4E2A;&#x7ED3;&#x679C;&#x8FDB;&#x884C;&#x8BA1;&#x7B97;&#x3002;</p>
<h2 id="Geohashes6"><a name="Geohashes6" class="anchor-navigation-ex-anchor" href="#Geohashes6"><i class="fa fa-link" aria-hidden="true"></i></a>Geohashes  </h2>
<p><a href="http://en.wikipedia.org/wiki/Geohash" target="_blank">Geohashes</a> &#x662F;&#x4E00;&#x79CD;&#x5C06;&#x7ECF;&#x7EAC;&#x5EA6;&#x5750;&#x6807;&#xFF08; <code>lat/lon</code> &#xFF09;&#x7F16;&#x7801;&#x6210;&#x5B57;&#x7B26;&#x4E32;&#x7684;&#x65B9;&#x5F0F;&#x3002; &#x8FD9;&#x4E48;&#x505A;&#x7684;&#x521D;&#x8877;&#x53EA;&#x662F;&#x4E3A;&#x4E86;&#x8BA9;&#x5730;&#x7406;&#x4F4D;&#x7F6E;&#x5728; url &#x4E0A;&#x5448;&#x73B0;&#x7684;&#x5F62;&#x5F0F;&#x66F4;&#x52A0;&#x53CB;&#x597D;&#xFF0C;&#x4F46;&#x73B0;&#x5728; geohashes &#x5DF2;&#x7ECF;&#x53D8;&#x6210;&#x4E00;&#x79CD;&#x5728;&#x6570;&#x636E;&#x5E93;&#x4E2D;&#x6709;&#x6548;&#x7D22;&#x5F15;&#x5730;&#x7406;&#x5750;&#x6807;&#x70B9;&#x548C;&#x5730;&#x7406;&#x5F62;&#x72B6;&#x7684;&#x65B9;&#x5F0F;&#x3002;</p>
<p>Geohashes &#x628A;&#x6574;&#x4E2A;&#x4E16;&#x754C;&#x5206;&#x4E3A; 32 &#x4E2A;&#x5355;&#x5143;&#x7684;&#x683C;&#x5B50; &#x2014;&#x2014; 4 &#x884C; 8 &#x5217; &#x2014;&#x2014; &#x6BCF;&#x4E00;&#x4E2A;&#x683C;&#x5B50;&#x90FD;&#x7528;&#x4E00;&#x4E2A;&#x5B57;&#x6BCD;&#x6216;&#x8005;&#x6570;&#x5B57;&#x6807;&#x8BC6;&#x3002;&#x6BD4;&#x5982; <code>g</code> &#x8FD9;&#x4E2A;&#x5355;&#x5143;&#x8986;&#x76D6;&#x4E86;&#x534A;&#x4E2A;&#x683C;&#x6797;&#x5170;&#xFF0C;&#x51B0;&#x5C9B;&#x7684;&#x5168;&#x90E8;&#x548C;&#x5927;&#x4E0D;&#x5217;&#x98A0;&#x7684;&#x5927;&#x90E8;&#x5206;&#x3002;&#x6BCF;&#x4E00;&#x4E2A;&#x5355;&#x5143;&#x8FD8;&#x53EF;&#x4EE5;&#x8FDB;&#x4E00;&#x6B65;&#x88AB;&#x5206;&#x89E3;&#x6210;&#x65B0;&#x7684; 32 &#x4E2A;&#x5355;&#x5143;&#xFF0C;&#x8FD9;&#x4E9B;&#x5355;&#x5143;&#x53C8;&#x53EF;&#x4EE5;&#x7EE7;&#x7EED;&#x88AB;&#x5206;&#x89E3;&#x6210; 32 &#x4E2A;&#x66F4;&#x5C0F;&#x7684;&#x5355;&#x5143;&#xFF0C;&#x4E0D;&#x65AD;&#x91CD;&#x590D;&#x4E0B;&#x53BB;&#x3002; <code>gc</code> &#x8FD9;&#x4E2A;&#x5355;&#x5143;&#x8986;&#x76D6;&#x4E86;&#x7231;&#x5C14;&#x5170;&#x548C;&#x82F1;&#x683C;&#x5170;&#xFF0C; <code>gcp</code> &#x8986;&#x76D6;&#x4E86;&#x4F26;&#x6566;&#x7684;&#x5927;&#x90E8;&#x5206;&#x548C;&#x90E8;&#x5206;&#x5357;&#x82F1;&#x683C;&#x5170;&#xFF0C; <code>gcpuuz94k</code> &#x662F;&#x767D;&#x91D1;&#x6C49;&#x5BAB;&#x7684;&#x5165;&#x53E3;&#xFF0C;&#x7CBE;&#x786E;&#x5230;&#x7EA6; 5 &#x7C73;&#x3002;</p>
<p>&#x6362;&#x53E5;&#x8BDD;&#x8BF4;&#xFF0C; geohash &#x7684;&#x957F;&#x5EA6;&#x8D8A;&#x957F;&#xFF0C;&#x5B83;&#x7684;&#x7CBE;&#x5EA6;&#x5C31;&#x8D8A;&#x9AD8;&#x3002;&#x5982;&#x679C;&#x4E24;&#x4E2A; geohashes &#x6709;&#x4E00;&#x4E2A;&#x5171;&#x540C;&#x7684;&#x524D;&#x7F00;&#x2014; <code>gcpuuz</code>&#x2014;&#x5C31;&#x8868;&#x793A;&#x4ED6;&#x4EEC;&#x6328;&#x5F97;&#x5F88;&#x8FD1;&#x3002;&#x5171;&#x540C;&#x7684;&#x524D;&#x7F00;&#x8D8A;&#x957F;&#xFF0C;&#x8DDD;&#x79BB;&#x5C31;&#x8D8A;&#x8FD1;&#x3002;</p>
<p>&#x8FD9;&#x4E5F;&#x610F;&#x5473;&#x7740;&#xFF0C;&#x4E24;&#x4E2A;&#x521A;&#x597D;&#x76F8;&#x90BB;&#x7684;&#x4F4D;&#x7F6E;&#xFF0C;&#x53EF;&#x80FD;&#x4F1A;&#x6709;&#x5B8C;&#x5168;&#x4E0D;&#x540C;&#x7684; geohash &#x3002;&#x6BD4;&#x5982;&#xFF0C;&#x4F26;&#x6566; <a href="http://en.wikipedia.org/wiki/Millennium_Dome" target="_blank">Millenium Dome</a> &#x7684; geohash &#x662F; <code>u10hbp</code> &#xFF0C;&#x56E0;&#x4E3A;&#x5B83;&#x843D;&#x5728;&#x4E86; <code>u</code> &#x8FD9;&#x4E2A;&#x5355;&#x5143;&#x91CC;&#xFF0C;&#x800C;&#x7D27;&#x6328;&#x7740;&#x5B83;&#x4E1C;&#x8FB9;&#x7684;&#x6700;&#x5927;&#x7684;&#x5355;&#x5143;&#x662F; <code>g</code> &#x3002;</p>
<p>&#x5730;&#x7406;&#x5750;&#x6807;&#x70B9;&#x53EF;&#x4EE5;&#x81EA;&#x52A8;&#x7D22;&#x5F15;&#x76F8;&#x5173;&#x7684; geohashes &#xFF0C;&#x66F4;&#x91CD;&#x8981;&#x7684;&#x662F;&#xFF0C;&#x4ED6;&#x4EEC;&#x4E5F;&#x53EF;&#x4EE5;&#x7D22;&#x5F15;&#x6240;&#x6709;&#x7684; geohashes <em>&#x524D;&#x7F00;</em> &#x3002;&#x5982;&#x7D22;&#x5F15;&#x767D;&#x91D1;&#x6C49;&#x5BAB;&#x5165;&#x53E3;&#x4F4D;&#x7F6E;&#x2014;&#x2014;&#x7EAC;&#x5EA6; <code>51.501568</code> &#xFF0C;&#x7ECF;&#x5EA6; <code>-0.141257</code>&#x2014;&#x5C06;&#x4F1A;&#x7D22;&#x5F15;&#x4E0B;&#x9762;&#x8868;&#x683C;&#x4E2D;&#x5217;&#x51FA;&#x7684;&#x6240;&#x6709; geohashes &#xFF0C;&#x8868;&#x683C;&#x4E2D;&#x4E5F;&#x7ED9;&#x51FA;&#x4E86;&#x5404;&#x4E2A; geohash &#x5355;&#x5143;&#x7684;&#x8FD1;&#x4F3C;&#x5C3A;&#x5BF8;&#xFF1A;</p>
<table>
<thead>
<tr>
<th>Geohash</th>
<th>Level</th>
<th>Dimensions</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>g</code></td>
<td><code>1</code></td>
<td>~ 5,004km x 5,004km</td>
</tr>
<tr>
<td><code>gc</code></td>
<td><code>2</code></td>
<td>~ 1,251km x 625km</td>
</tr>
<tr>
<td><code>gcp</code></td>
<td><code>3</code></td>
<td>~ 156km x 156km</td>
</tr>
<tr>
<td><code>gcpu</code></td>
<td><code>4</code></td>
<td>~ 39km x 19.5km</td>
</tr>
<tr>
<td><code>gcpuu</code></td>
<td><code>5</code></td>
<td>~ 4.9km x 4.9km</td>
</tr>
<tr>
<td><code>gcpuuz</code></td>
<td><code>6</code></td>
<td>~ 1.2km x 0.61km</td>
</tr>
<tr>
<td><code>gcpuuz9</code></td>
<td><code>7</code></td>
<td>~ 152.8m x 152.8m</td>
</tr>
<tr>
<td><code>gcpuuz94</code></td>
<td><code>8</code></td>
<td>~ 38.2m x 19.1m</td>
</tr>
<tr>
<td><code>gcpuuz94k</code></td>
<td><code>9</code></td>
<td>~ 4.78m x 4.78m</td>
</tr>
<tr>
<td><code>gcpuuz94kk</code></td>
<td><code>10</code></td>
<td>~ 1.19m x 0.60m</td>
</tr>
<tr>
<td><code>gcpuuz94kkp</code></td>
<td><code>11</code></td>
<td>~ 14.9cm x 14.9cm</td>
</tr>
<tr>
<td><code>gcpuuz94kkp5</code></td>
<td><code>12</code></td>
<td>~ 3.7cm x 1.8cm</td>
</tr>
</tbody>
</table>
<p><a href="https://www.elastic.co/guide/en/elasticsearch/reference/2.4/query-dsl-geohash-cell-query.html" target="_blank"><code>geohash&#x5355;&#x5143;</code> &#x8FC7;&#x6EE4;&#x5668;</a> &#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x8FD9;&#x4E9B; geohash &#x524D;&#x7F00; &#x6765;&#x627E;&#x51FA;&#x4E0E;&#x6307;&#x5B9A;&#x5750;&#x6807;&#x70B9;&#xFF08; <code>lat/lon</code> &#xFF09;&#x76F8;&#x90BB;&#x7684;&#x4F4D;&#x7F6E;&#x3002;</p>
<h3 id="Geohashes&#x6620;&#x5C04;"><a name="Geohashes&#x6620;&#x5C04;" class="anchor-navigation-ex-anchor" href="#Geohashes&#x6620;&#x5C04;"><i class="fa fa-link" aria-hidden="true"></i></a>Geohashes &#x6620;&#x5C04;  </h3>
<p>&#x9996;&#x5148;&#xFF0C;&#x4F60;&#x9700;&#x8981;&#x51B3;&#x5B9A;&#x4F7F;&#x7528;&#x4EC0;&#x4E48;&#x6837;&#x7684;&#x7CBE;&#x5EA6;&#x3002; &#x867D;&#x7136;&#x4F60;&#x4E5F;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; 12 &#x7EA7;&#x7684;&#x7CBE;&#x5EA6;&#x6765;&#x7D22;&#x5F15;&#x6240;&#x6709;&#x7684;&#x5730;&#x7406;&#x5750;&#x6807;&#x70B9;&#xFF0C;&#x4F46;&#x662F;&#x4F60;&#x771F;&#x7684;&#x9700;&#x8981;&#x7CBE;&#x786E;&#x5230;&#x6570;&#x5398;&#x7C73;&#x5417;&#xFF1F;&#x5982;&#x679C;&#x4F60;&#x628A;&#x7CBE;&#x5EA6;&#x63A7;&#x5236;&#x5728;&#x4E00;&#x4E2A;&#x5B9E;&#x9645;&#x4E00;&#x4E9B;&#x7684;&#x503C;&#xFF0C;&#x6BD4;&#x5982; <code>1km</code> &#xFF0C;&#x90A3;&#x4E48;&#x4F60;&#x53EF;&#x4EE5;&#x8282;&#x7701;&#x5927;&#x91CF;&#x7684;&#x7D22;&#x5F15;&#x7A7A;&#x95F4;&#xFF1A;</p>
<pre><code class="lang-json">PUT /attractions
{
  <span class="hljs-string">&quot;mappings&quot;</span>: {
    <span class="hljs-string">&quot;restaurant&quot;</span>: {
      <span class="hljs-string">&quot;properties&quot;</span>: {
        <span class="hljs-string">&quot;name&quot;</span>: {
          <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>
        },
        <span class="hljs-string">&quot;location&quot;</span>: {
          <span class="hljs-string">&quot;type&quot;</span>:               <span class="hljs-string">&quot;geo_point&quot;</span>,
          <span class="hljs-string">&quot;geohash_prefix&quot;</span>:     <span class="hljs-literal">true</span>,             &lt;1&gt;
          &quot;geohash_precision&quot;:  &quot;1km&quot;             &lt;2&gt;
        }
      }
    }
  }
}
</code></pre>
<blockquote>
<p> <img src="assets/1.png" alt="img">  &#x5C06; <code>geohash_prefix</code> &#x8BBE;&#x4E3A; <code>true</code> &#x6765;&#x544A;&#x8BC9; Elasticsearch &#x4F7F;&#x7528;&#x6307;&#x5B9A;&#x7CBE;&#x5EA6;&#x6765;&#x7D22;&#x5F15; geohash &#x7684;&#x524D;&#x7F00;&#x3002;  </p>
<p> <img src="assets/2.png" alt="img">  &#x7CBE;&#x5EA6;&#x53EF;&#x4EE5;&#x662F;&#x4E00;&#x4E2A;&#x5177;&#x4F53;&#x7684;&#x6570;&#x5B57;&#xFF0C;&#x4EE3;&#x8868;&#x7684; geohash &#x7684;&#x957F;&#x5EA6;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x662F;&#x4E00;&#x4E2A;&#x8DDD;&#x79BB;&#x3002; <code>1km</code> &#x7684;&#x7CBE;&#x5EA6;&#x5BF9;&#x5E94;&#x7684; geohash &#x7684;&#x957F;&#x5EA6;&#x662F; <code>7</code> &#x3002;   </p>
</blockquote>
<p>&#x901A;&#x8FC7;&#x5982;&#x4E0A;&#x8BBE;&#x7F6E;&#xFF0C; geohash &#x524D;&#x7F00;&#x4E2D; 1 &#x5230; 7 &#x7684;&#x90E8;&#x5206;&#x5C06;&#x88AB;&#x7D22;&#x5F15;&#xFF0C;&#x6240;&#x80FD;&#x63D0;&#x4F9B;&#x7684;&#x7CBE;&#x5EA6;&#x5927;&#x7EA6;&#x5728; 150 &#x7C73;&#x3002;</p>
<h3 id="Geohash&#x5355;&#x5143;&#x67E5;&#x8BE2;"><a name="Geohash&#x5355;&#x5143;&#x67E5;&#x8BE2;" class="anchor-navigation-ex-anchor" href="#Geohash&#x5355;&#x5143;&#x67E5;&#x8BE2;"><i class="fa fa-link" aria-hidden="true"></i></a>Geohash &#x5355;&#x5143;&#x67E5;&#x8BE2;  </h3>
<p><code>geohash_cell</code> &#x67E5;&#x8BE2;&#x505A;&#x7684;&#x4E8B;&#x60C5;&#x975E;&#x5E38;&#x7B80;&#x5355;&#xFF1A; &#x628A;&#x7ECF;&#x7EAC;&#x5EA6;&#x5750;&#x6807;&#x4F4D;&#x7F6E;&#x6839;&#x636E;&#x6307;&#x5B9A;&#x7CBE;&#x5EA6;&#x8F6C;&#x6362;&#x6210;&#x4E00;&#x4E2A; geohash &#xFF0C;&#x7136;&#x540E;&#x67E5;&#x627E;&#x6240;&#x6709;&#x5305;&#x542B;&#x8FD9;&#x4E2A; geohash &#x7684;&#x4F4D;&#x7F6E;&#x2014;&#x2014;&#x8FD9;&#x662F;&#x975E;&#x5E38;&#x9AD8;&#x6548;&#x7684;&#x67E5;&#x8BE2;&#x3002;</p>
<pre><code class="lang-json">GET /attractions/restaurant/_search
{
  <span class="hljs-string">&quot;query&quot;</span>: {
    <span class="hljs-string">&quot;constant_score&quot;</span>: {
      <span class="hljs-string">&quot;filter&quot;</span>: {
        <span class="hljs-string">&quot;geohash_cell&quot;</span>: {
          <span class="hljs-string">&quot;location&quot;</span>: {
            <span class="hljs-string">&quot;lat&quot;</span>:  <span class="hljs-number">40.718</span>,
            <span class="hljs-string">&quot;lon&quot;</span>: <span class="hljs-number">-73.983</span>
          },
          <span class="hljs-string">&quot;precision&quot;</span>: <span class="hljs-string">&quot;2km&quot;</span> 
        }
      }
    }
  }
}
</code></pre>
<blockquote>
<p> <img src="assets/1.png" alt="img">  <code>precision</code> &#x5B57;&#x6BB5;&#x8BBE;&#x7F6E;&#x7684;&#x7CBE;&#x5EA6;&#x4E0D;&#x80FD;&#x9AD8;&#x4E8E;&#x6620;&#x5C04;&#x65F6; <code>geohash_precision</code> &#x5B57;&#x6BB5;&#x6307;&#x5B9A;&#x7684;&#x503C;&#x3002;   </p>
</blockquote>
<p>&#x6B64;&#x67E5;&#x8BE2;&#x5C06; <code>lat/lon</code> &#x5750;&#x6807;&#x70B9;&#x8F6C;&#x6362;&#x6210;&#x5BF9;&#x5E94;&#x957F;&#x5EA6;&#x7684; geohash &#x2014;&#x2014; &#x672C;&#x4F8B;&#x4E2D;&#x4E3A; <code>dr5rsk</code>&#x2014;&#x7136;&#x540E;&#x67E5;&#x627E;&#x6240;&#x6709;&#x5305;&#x542B;&#x8FD9;&#x4E2A;&#x77ED;&#x8BED;&#x7684;&#x4F4D;&#x7F6E;&#x3002;</p>
<p>&#x7136;&#x800C;&#xFF0C;&#x5982;&#x4E0A;&#x4F8B;&#x4E2D;&#x7684;&#x5199;&#x6CD5;&#x53EF;&#x80FD;&#x4E0D;&#x4F1A;&#x8FD4;&#x56DE; 2km &#x5185;&#x6240;&#x6709;&#x7684;&#x9910;&#x9986;&#x3002;&#x8981;&#x77E5;&#x9053; geohash &#x5B9E;&#x9645;&#x4E0A;&#x4EC5;&#x662F;&#x4E2A;&#x77E9;&#x5F62;&#xFF0C;&#x800C;&#x6307;&#x5B9A;&#x7684;&#x70B9;&#x53EF;&#x80FD;&#x4F4D;&#x4E8E;&#x8FD9;&#x4E2A;&#x77E9;&#x5F62;&#x4E2D;&#x7684;&#x4EFB;&#x4F55;&#x4F4D;&#x7F6E;&#x3002;&#x6709;&#x53EF;&#x80FD;&#x8FD9;&#x4E2A;&#x70B9;&#x521A;&#x597D;&#x843D;&#x5728;&#x4E86; geohash &#x5355;&#x5143;&#x7684;&#x8FB9;&#x7F18;&#x9644;&#x8FD1;&#xFF0C;&#x4F46;&#x8FC7;&#x6EE4;&#x5668;&#x4F1A;&#x6392;&#x9664;&#x90A3;&#x4E9B;&#x843D;&#x5728;&#x76F8;&#x90BB;&#x5355;&#x5143;&#x7684;&#x9910;&#x9986;&#x3002;</p>
<p>&#x4E3A;&#x4E86;&#x4FEE;&#x590D;&#x8FD9;&#x4E2A;&#x95EE;&#x9898;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x8BBE;&#x7F6E; <code>neighbors</code>&#x53C2;&#x6570;&#x4E3A; <code>true</code> &#xFF0C;&#x8BA9;&#x67E5;&#x8BE2;&#x628A;&#x5468;&#x56F4;&#x7684;&#x5355;&#x5143;&#x4E5F;&#x5305;&#x542B;&#x8FDB;&#x6765;&#xFF1A;</p>
<pre><code class="lang-json">GET /attractions/restaurant/_search
{
  <span class="hljs-string">&quot;query&quot;</span>: {
    <span class="hljs-string">&quot;constant_score&quot;</span>: {
      <span class="hljs-string">&quot;filter&quot;</span>: {
        <span class="hljs-string">&quot;geohash_cell&quot;</span>: {
          <span class="hljs-string">&quot;location&quot;</span>: {
            <span class="hljs-string">&quot;lat&quot;</span>:  <span class="hljs-number">40.718</span>,
            <span class="hljs-string">&quot;lon&quot;</span>: <span class="hljs-number">-73.983</span>
          },
          <span class="hljs-string">&quot;neighbors&quot;</span>: <span class="hljs-literal">true</span>,     <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">1</span>&gt;</span>
          &quot;precision&quot;: &quot;2km&quot;
        }
      }
    }
  }
}
</span></code></pre>
<blockquote>
<p> <img src="assets/1.png" alt="img">  &#x6B64;&#x67E5;&#x8BE2;&#x5C06;&#x4F1A;&#x5BFB;&#x627E;&#x5BF9;&#x5E94;&#x7684; geohash &#x548C;&#x5305;&#x56F4;&#x5B83;&#x7684; geohashes &#x3002;   </p>
</blockquote>
<p>&#x660E;&#x663E;&#x7684;&#xFF0C; <code>2km</code> &#x7CBE;&#x5EA6;&#x7684; geohash &#x52A0;&#x4E0A;&#x5468;&#x56F4;&#x7684;&#x5355;&#x5143;&#xFF0C;&#x6700;&#x7EC8;&#x5BFC;&#x81F4;&#x4E00;&#x4E2A;&#x8303;&#x56F4;&#x6781;&#x5927;&#x7684;&#x641C;&#x7D22;&#x533A;&#x57DF;&#x3002;&#x6B64;&#x67E5;&#x8BE2;&#x4E0D;&#x662F;&#x4E3A;&#x7CBE;&#x5EA6;&#x800C;&#x751F;&#xFF0C;&#x4F46;&#x662F;&#x5B83;&#x975E;&#x5E38;&#x6709;&#x6548;&#x7387;&#xFF0C;&#x800C;&#x4E14;&#x53EF;&#x4EE5;&#x4F5C;&#x4E3A;&#x66F4;&#x9AD8;&#x7CBE;&#x5EA6;&#x7684;&#x5730;&#x7406;&#x4F4D;&#x7F6E;&#x8FC7;&#x6EE4;&#x5668;&#x7684;&#x524D;&#x7F6E;&#x8FC7;&#x6EE4;&#x5668;&#x3002;</p>
<blockquote>
<p> <img src="assets/tip.png" alt="&#x63D0;&#x793A;">  &#x5C06; <code>precision</code> &#x53C2;&#x6570;&#x8BBE;&#x7F6E;&#x4E3A;&#x4E00;&#x4E2A;&#x8DDD;&#x79BB;&#x53EF;&#x80FD;&#x4F1A;&#x6709;&#x8BEF;&#x5BFC;&#x6027;&#x3002; <code>2km</code> &#x7684; <code>precision</code> &#x4F1A;&#x88AB;&#x8F6C;&#x6362;&#x6210;&#x957F;&#x5EA6;&#x4E3A; 6 &#x7684; geohash &#x3002;&#x5B9E;&#x9645;&#x4E0A;&#x5B83;&#x7684;&#x5C3A;&#x5BF8;&#x662F;&#x7EA6; 1.2km x 0.6km&#x3002;&#x4F60;&#x53EF;&#x80FD;&#x4F1A;&#x53D1;&#x73B0;&#x660E;&#x786E;&#x7684;&#x8BBE;&#x7F6E;&#x957F;&#x5EA6;&#x4E3A; <code>5</code>&#x6216; <code>6</code> &#x4F1A;&#x66F4;&#x5BB9;&#x6613;&#x7406;&#x89E3;&#x3002;  </p>
</blockquote>
<p>&#x6B64;&#x67E5;&#x8BE2;&#x7684;&#x53E6;&#x4E00;&#x4E2A;&#x4F18;&#x70B9;&#x662F;&#xFF0C;&#x76F8;&#x6BD4; <code>geo_bounding_box</code> &#x67E5;&#x8BE2;&#xFF0C;&#x5B83;&#x652F;&#x6301;&#x4E00;&#x4E2A;&#x5B57;&#x6BB5;&#x4E2D;&#x6709;&#x591A;&#x4E2A;&#x5750;&#x6807;&#x4F4D;&#x7F6E;&#x7684;&#x60C5;&#x51B5;&#x3002; &#x6211;&#x4EEC;&#x5728; <a href="https://www.elastic.co/guide/cn/elasticsearch/guide/current/geo-bounding-box.html#optimize-bounding-box" target="_blank">&#x4F18;&#x5316;&#x76D2;&#x6A21;&#x578B;</a> &#x4E2D;&#x8BA8;&#x8BBA;&#x8FC7;&#xFF0C;&#x8BBE;&#x7F6E; <code>lat_lon</code> &#x9009;&#x9879;&#x4E5F;&#x662F;&#x4E00;&#x4E2A;&#x5F88;&#x6709;&#x6548;&#x7684;&#x65B9;&#x5F0F;&#xFF0C;&#x4F46;&#x662F;&#x5B83;&#x53EA;&#x5728;&#x6BCF;&#x4E2A;&#x5B57;&#x6BB5;&#x53EA;&#x6709;&#x5355;&#x4E2A;&#x5750;&#x6807;&#x70B9;&#x7684;&#x60C5;&#x51B5;&#x4E0B;&#x6709;&#x6548;&#x3002;</p>
<h2 id="&#x5730;&#x7406;&#x4F4D;&#x7F6E;&#x805A;&#x5408;"><a name="&#x5730;&#x7406;&#x4F4D;&#x7F6E;&#x805A;&#x5408;" class="anchor-navigation-ex-anchor" href="#&#x5730;&#x7406;&#x4F4D;&#x7F6E;&#x805A;&#x5408;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5730;&#x7406;&#x4F4D;&#x7F6E;&#x805A;&#x5408;</h2>
<p>&#x867D;&#x7136;&#x6309;&#x7167;&#x5730;&#x7406;&#x4F4D;&#x7F6E;&#x5BF9;&#x7ED3;&#x679C;&#x8FDB;&#x884C;&#x8FC7;&#x6EE4;&#x6216;&#x8005;&#x6253;&#x5206;&#x5F88;&#x6709;&#x7528;&#xFF0C; &#x4F46;&#x662F;&#x5728;&#x5730;&#x56FE;&#x4E0A;&#x5448;&#x73B0;&#x4FE1;&#x606F;&#x7ED9;&#x7528;&#x6237;&#x901A;&#x5E38;&#x66F4;&#x52A0;&#x6709;&#x7528;&#x3002;&#x4E00;&#x4E2A;&#x67E5;&#x8BE2;&#x53EF;&#x80FD;&#x4F1A;&#x8FD4;&#x56DE;&#x592A;&#x591A;&#x7ED3;&#x679C;&#x4EE5;&#x81F3;&#x4E8E;&#x4E0D;&#x80FD;&#x5355;&#x72EC;&#x5730;&#x5C55;&#x73B0;&#x6BCF;&#x4E00;&#x4E2A;&#x5730;&#x7406;&#x5750;&#x6807;&#x70B9;&#xFF0C;&#x4F46;&#x662F;&#x5730;&#x7406;&#x4F4D;&#x7F6E;&#x805A;&#x5408;&#x53EF;&#x4EE5;&#x7528;&#x6765;&#x5C06;&#x5730;&#x7406;&#x5750;&#x6807;&#x805A;&#x96C6;&#x5230;&#x66F4;&#x52A0;&#x5BB9;&#x6613;&#x7BA1;&#x7406;&#x7684; buckets &#x4E2D;&#x3002;</p>
<p>&#x5904;&#x7406; <code>geo_point</code> &#x7C7B;&#x578B;&#x5B57;&#x6BB5;&#x7684;&#x4E09;&#x79CD;&#x805A;&#x5408;&#xFF1A;</p>
<ul>
<li><p><a href="https://www.elastic.co/guide/cn/elasticsearch/guide/current/geo-distance-agg.html" target="_blank"><code>&#x5730;&#x7406;&#x4F4D;&#x7F6E;&#x8DDD;&#x79BB;</code></a></p>
<p>&#x5C06;&#x6587;&#x6863;&#x6309;&#x7167;&#x8DDD;&#x79BB;&#x56F4;&#x7ED5;&#x4E00;&#x4E2A;&#x4E2D;&#x5FC3;&#x70B9;&#x6765;&#x5206;&#x7EC4;&#x3002;</p>
</li>
<li><p><a href="https://www.elastic.co/guide/cn/elasticsearch/guide/current/geohash-grid-agg.html" target="_blank"><code>geohash &#x7F51;&#x683C;</code></a></p>
<p>&#x5C06;&#x6587;&#x6863;&#x6309;&#x7167; geohash &#x8303;&#x56F4;&#x6765;&#x5206;&#x7EC4;&#xFF0C;&#x7528;&#x6765;&#x663E;&#x793A;&#x5728;&#x5730;&#x56FE;&#x4E0A;&#x3002;</p>
</li>
<li><p><a href="https://www.elastic.co/guide/cn/elasticsearch/guide/current/geo-bounds-agg.html" target="_blank"><code>&#x5730;&#x7406;&#x4F4D;&#x7F6E;&#x8FB9;&#x754C;</code></a></p>
<p>&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x5305;&#x542B;&#x6240;&#x6709;&#x5730;&#x7406;&#x4F4D;&#x7F6E;&#x5750;&#x6807;&#x70B9;&#x7684;&#x8FB9;&#x754C;&#x7684;&#x7ECF;&#x7EAC;&#x5EA6;&#x5750;&#x6807;&#xFF0C;&#x8FD9;&#x5BF9;&#x663E;&#x793A;&#x5730;&#x56FE;&#x65F6;&#x7F29;&#x653E;&#x6BD4;&#x4F8B;&#x7684;&#x9009;&#x62E9;&#x975E;&#x5E38;&#x6709;&#x7528;&#x3002;</p>
</li>
</ul>
<h3 id="&#x5730;&#x7406;&#x8DDD;&#x79BB;&#x805A;&#x5408;"><a name="&#x5730;&#x7406;&#x8DDD;&#x79BB;&#x805A;&#x5408;" class="anchor-navigation-ex-anchor" href="#&#x5730;&#x7406;&#x8DDD;&#x79BB;&#x805A;&#x5408;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5730;&#x7406;&#x8DDD;&#x79BB;&#x805A;&#x5408;</h3>
<p><code>geo_distance</code> &#x805A;&#x5408; &#x5BF9;&#x4E00;&#x4E9B;&#x641C;&#x7D22;&#x975E;&#x5E38;&#x6709;&#x7528;&#xFF0C;&#x4F8B;&#x5982;&#x627E;&#x5230;&#x6240;&#x6709;&#x8DDD;&#x79BB;&#x6211; 1km &#x4EE5;&#x5185;&#x7684;&#x62AB;&#x8428;&#x5E97;&#x3002;&#x641C;&#x7D22;&#x7ED3;&#x679C;&#x5E94;&#x8BE5;&#x4E5F;&#x7684;&#x786E;&#x88AB;&#x9650;&#x5236;&#x5728;&#x7528;&#x6237;&#x6307;&#x5B9A; 1km &#x8303;&#x56F4;&#x5185;&#xFF0C;&#x4F46;&#x662F;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x6DFB;&#x52A0;&#x5728; 2km &#x8303;&#x56F4;&#x5185;&#x627E;&#x5230;&#x7684;&#x5176;&#x4ED6;&#x7ED3;&#x679C;&#xFF1A;</p>
<pre><code class="lang-json">GET /attractions/restaurant/_search
{
  <span class="hljs-string">&quot;query&quot;</span>: {
    <span class="hljs-string">&quot;bool&quot;</span>: {
      <span class="hljs-string">&quot;must&quot;</span>: {                           &lt;1&gt;
        &quot;match&quot;: { 
          &quot;name&quot;: &quot;pizza&quot;
        }
      },
      &quot;filter&quot;: {
        &quot;geo_bounding_box&quot;: {
          &quot;location&quot;: {                   &lt;2&gt;
            &quot;top_left&quot;: {
              &quot;lat&quot;:  40.8,
              &quot;lon&quot;: -74.1
            },
            &quot;bottom_right&quot;: {
              &quot;lat&quot;:  40.4,
              &quot;lon&quot;: -73.7
            }
          }
        }
      }
    }
  },
  &quot;aggs&quot;: {
    &quot;per_ring&quot;: {
      &quot;geo_distance&quot;: {                   &lt;3&gt;
        &quot;field&quot;:    &quot;location&quot;,
        &quot;unit&quot;:     &quot;km&quot;,
        &quot;origin&quot;: {
          &quot;lat&quot;:    40.712,
          &quot;lon&quot;:   -73.988
        },
        &quot;ranges&quot;: [
          { &quot;from&quot;: 0, &quot;to&quot;: 1 },
          { &quot;from&quot;: 1, &quot;to&quot;: 2 }
        ]
      }
    }
  },
  &quot;post_filter&quot;: {                       &lt;4&gt;
    &quot;geo_distance&quot;: {
      &quot;distance&quot;:   &quot;1km&quot;,
      &quot;location&quot;: {
        &quot;lat&quot;:      40.712,
        &quot;lon&quot;:     -73.988
      }
    }
  }
}
</code></pre>
<blockquote>
<p> <img src="assets/1.png" alt="img">   &#x4E3B;&#x67E5;&#x8BE2;&#x67E5;&#x627E;&#x540D;&#x79F0;&#x4E2D;&#x542B;&#x6709; <code>pizza</code> &#x7684;&#x996D;&#x5E97;&#x3002;   </p>
<p> <img src="assets/2.png" alt="img">   <code>geo_bounding_box</code> &#x7B5B;&#x9009;&#x90A3;&#x4E9B;&#x53EA;&#x5728;&#x7EBD;&#x7EA6;&#x533A;&#x57DF;&#x7684;&#x7ED3;&#x679C;&#x3002;    </p>
<p> <img src="assets/3.png" alt="img">   <code>geo_distance</code> &#x805A;&#x5408;&#x7EDF;&#x8BA1;&#x8DDD;&#x79BB;&#x7528;&#x6237; 1km &#x4EE5;&#x5185;&#xFF0C;1km &#x5230; 2km &#x7684;&#x7ED3;&#x679C;&#x7684;&#x6570;&#x91CF;&#x3002;   </p>
<p> <img src="assets/4.png" alt="img">   &#x6700;&#x540E;&#xFF0C;<code>post_filter</code> &#x5C06;&#x7ED3;&#x679C;&#x7F29;&#x5C0F;&#x81F3;&#x90A3;&#x4E9B;&#x5728;&#x7528;&#x6237; 1km &#x8303;&#x56F4;&#x5185;&#x7684;&#x996D;&#x5E97;&#x3002; </p>
</blockquote>
<p>&#x524D;&#x9762;&#x7684;&#x8BF7;&#x6C42; &#x54CD;&#x5E94;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-json"><span class="hljs-string">&quot;hits&quot;</span>: {
  <span class="hljs-string">&quot;total&quot;</span>:     <span class="hljs-number">1</span>,
  <span class="hljs-string">&quot;max_score&quot;</span>: <span class="hljs-number">0.15342641</span>,
  <span class="hljs-string">&quot;hits&quot;</span>: [                                   &lt;1&gt;
     {
        &quot;_index&quot;: &quot;attractions&quot;,
        &quot;_type&quot;:  &quot;restaurant&quot;,
        &quot;_id&quot;:    &quot;3&quot;,
        &quot;_score&quot;: 0.15342641,
        &quot;_source&quot;: {
           &quot;name&quot;: &quot;Mini Munchies Pizza&quot;,
           &quot;location&quot;: [
              -73.983,
              40.719
           ]
        }
     }
  ]
},
&quot;aggregations&quot;: {
  &quot;per_ring&quot;: {                                &lt;2&gt;
     &quot;buckets&quot;: [
        {
           &quot;key&quot;:       &quot;*-1.0&quot;,
           &quot;from&quot;:      0,
           &quot;to&quot;:        1,
           &quot;doc_count&quot;: 1
        },
        {
           &quot;key&quot;:       &quot;1.0-2.0&quot;,
           &quot;from&quot;:      1,
           &quot;to&quot;:        2,
           &quot;doc_count&quot;: 1
        }
     ]
  }
}
</code></pre>
<blockquote>
<p> <img src="assets/1.png" alt="img">   <code>post_filter</code> &#x5DF2;&#x7ECF;&#x5C06;&#x641C;&#x7D22;&#x7ED3;&#x679C;&#x7F29;&#x5C0F;&#x81F3;&#x4EC5;&#x5728;&#x7528;&#x6237; 1km &#x8303;&#x56F4;&#x4EE5;&#x5185;&#x7684;&#x62AB;&#x8428;&#x5E97;&#x3002;   </p>
<p> <img src="assets/2.png" alt="img">  &#x805A;&#x5408;&#x5305;&#x62EC;&#x641C;&#x7D22;&#x7ED3;&#x679C;&#x52A0;&#x4E0A;&#x5176;&#x4ED6;&#x5728;&#x7528;&#x6237; 2km &#x8303;&#x56F4;&#x4EE5;&#x5185;&#x7684;&#x62AB;&#x8428;&#x5E97;&#x3002;  </p>
</blockquote>
<p>&#x5728;&#x8FD9;&#x4E2A;&#x4F8B;&#x5B50;&#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x8BA1;&#x7B97;&#x4E86;&#x843D;&#x5728;&#x6BCF;&#x4E2A;&#x540C;&#x5FC3;&#x73AF;&#x5185;&#x7684;&#x996D;&#x5E97;&#x6570;&#x91CF;&#x3002;&#x5F53;&#x7136;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x5728; <code>per_rings</code> &#x805A;&#x5408;&#x4E0B;&#x9762;&#x5D4C;&#x5957;&#x5B50;&#x805A;&#x5408;&#x6765;&#x8BA1;&#x7B97;&#x6BCF;&#x4E2A;&#x73AF;&#x7684;&#x5E73;&#x5747;&#x4EF7;&#x683C;&#x3001;&#x6700;&#x53D7;&#x6B22;&#x8FCE;&#x7A0B;&#x5EA6;&#xFF0C;&#x7B49;&#x7B49;&#x3002;</p>
<h3 id="Geohash&#x7F51;&#x683C;&#x805A;&#x5408;"><a name="Geohash&#x7F51;&#x683C;&#x805A;&#x5408;" class="anchor-navigation-ex-anchor" href="#Geohash&#x7F51;&#x683C;&#x805A;&#x5408;"><i class="fa fa-link" aria-hidden="true"></i></a>Geohash &#x7F51;&#x683C;&#x805A;&#x5408;  </h3>
<p>&#x901A;&#x8FC7;&#x4E00;&#x4E2A;&#x67E5;&#x8BE2;&#x8FD4;&#x56DE;&#x7684;&#x7ED3;&#x679C;&#x6570;&#x91CF;&#x5BF9;&#x5728;&#x5730;&#x56FE;&#x4E0A;&#x5355;&#x72EC;&#x7684;&#x663E;&#x793A;&#x6BCF;&#x4E00;&#x4E2A;&#x4F4D;&#x7F6E;&#x70B9;&#x800C;&#x8A00;&#x53EF;&#x80FD;&#x592A;&#x591A;&#x4E86;&#x3002; <code>geohash_grid</code> &#x6309;&#x7167;&#x4F60;&#x5B9A;&#x4E49;&#x7684;&#x7CBE;&#x5EA6;&#x8BA1;&#x7B97;&#x6BCF;&#x4E00;&#x4E2A;&#x70B9;&#x7684; geohash &#x503C;&#x800C;&#x5C06;&#x9644;&#x8FD1;&#x7684;&#x4F4D;&#x7F6E;&#x805A;&#x5408;&#x5728;&#x4E00;&#x8D77;&#x3002;</p>
<p>&#x7ED3;&#x679C;&#x662F;&#x4E00;&#x4E2A;&#x7F51;&#x683C;&#x2014;&#x4E00;&#x4E2A;&#x5355;&#x5143;&#x683C;&#x8868;&#x793A;&#x4E00;&#x4E2A;&#x53EF;&#x4EE5;&#x663E;&#x793A;&#x5728;&#x5730;&#x56FE;&#x4E0A;&#x7684; geohash &#x3002;&#x901A;&#x8FC7;&#x6539;&#x53D8; geohash &#x7684;&#x7CBE;&#x5EA6;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x6309;&#x56FD;&#x5BB6;&#x6216;&#x8005;&#x57CE;&#x5E02;&#x8857;&#x533A;&#x6765;&#x6982;&#x62EC;&#x5168;&#x4E16;&#x754C;&#x3002;</p>
<p>&#x805A;&#x5408;&#x662F;&#x7A00;&#x758F;&#x7684;&#x2014;&#x5B83; &#x4EC5;&#x8FD4;&#x56DE;&#x90A3;&#x4E9B;&#x542B;&#x6709;&#x6587;&#x6863;&#x7684;&#x5355;&#x5143;&#x3002; &#x5982;&#x679C; geohashes &#x592A;&#x7CBE;&#x786E;&#xFF0C;&#x5C06;&#x4EA7;&#x751F;&#x592A;&#x591A;&#x7684; buckets&#xFF0C;&#x5B83;&#x5C06;&#x9ED8;&#x8BA4;&#x8FD4;&#x56DE;&#x90A3;&#x4E9B;&#x5305;&#x542B;&#x4E86;&#x5927;&#x91CF;&#x6587;&#x6863;&#x3001;&#x6700;&#x5BC6;&#x96C6;&#x7684;10000&#x4E2A;&#x5355;&#x5143;&#x3002; &#x7136;&#x800C;&#xFF0C;&#x4E3A;&#x4E86;&#x8BA1;&#x7B97;&#x54EA;&#x4E9B;&#x662F;&#x6700;&#x5BC6;&#x96C6;&#x7684; Top10000 &#xFF0C;&#x5B83;&#x8FD8;&#x662F;&#x9700;&#x8981;&#x4EA7;&#x751F; <em>&#x6240;&#x6709;</em> &#x7684; buckets &#x3002;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x4EE5;&#x4E0B;&#x65B9;&#x5F0F;&#x6765;&#x63A7;&#x5236; buckets &#x7684;&#x4EA7;&#x751F;&#x6570;&#x91CF;&#xFF1A;</p>
<ol>
<li>&#x4F7F;&#x7528; <code>geo_bounding_box</code> &#x6765;&#x9650;&#x5236;&#x7ED3;&#x679C;&#x3002;</li>
<li>&#x4E3A;&#x4F60;&#x7684;&#x8FB9;&#x754C;&#x5927;&#x5C0F;&#x9009;&#x62E9;&#x4E00;&#x4E2A;&#x9002;&#x5F53;&#x7684; <code>precision</code> (&#x7CBE;&#x5EA6;)</li>
</ol>
<pre><code class="lang-json">GET /attractions/restaurant/_search
{
  <span class="hljs-string">&quot;size&quot;</span> : <span class="hljs-number">0</span>,
  <span class="hljs-string">&quot;query&quot;</span>: {
    <span class="hljs-string">&quot;constant_score&quot;</span>: {
      <span class="hljs-string">&quot;filter&quot;</span>: {
        <span class="hljs-string">&quot;geo_bounding_box&quot;</span>: {
          <span class="hljs-string">&quot;location&quot;</span>: {                   &lt;1&gt;
            &quot;top_left&quot;: {
              &quot;lat&quot;:  40.8,
              &quot;lon&quot;: -74.1
            },
            &quot;bottom_right&quot;: {
              &quot;lat&quot;:  40.4,
              &quot;lon&quot;: -73.7
            }
          }
        }
      }
    }
  },
  &quot;aggs&quot;: {
    &quot;new_york&quot;: {
      &quot;geohash_grid&quot;: {                   &lt;2&gt;
        &quot;field&quot;:     &quot;location&quot;,
        &quot;precision&quot;: 5
      }
    }
  }
}
</code></pre>
<blockquote>
<p> <img src="assets/1.png" alt="img">  &#x8FB9;&#x754C;&#x6846;&#x5C06;&#x641C;&#x7D22;&#x9650;&#x5236;&#x5728;&#x5927;&#x7EBD;&#x7EA6;&#x533A;&#x7684;&#x8303;&#x56F4;       </p>
<p> <img src="assets/2.png" alt="img">  Geohashes &#x7CBE;&#x5EA6;&#x4E3A; <code>5</code> &#x5927;&#x7EA6;&#x662F; 5km x 5km&#x3002;   </p>
</blockquote>
<p>Geohashes &#x7CBE;&#x5EA6;&#x4E3A; <code>5</code> &#xFF0C;&#x6BCF;&#x4E2A;&#x7EA6;25&#x5E73;&#x65B9;&#x516C;&#x91CC;&#xFF0C;&#x6240;&#x4EE5;10000&#x4E2A;&#x5355;&#x5143;&#x6309;&#x8FD9;&#x4E2A;&#x7CBE;&#x5EA6;&#x5C06;&#x8986;&#x76D6;250000&#x5E73;&#x65B9;&#x516C;&#x91CC;&#x3002;&#x6211;&#x4EEC;&#x6307;&#x5B9A;&#x7684;&#x8FB9;&#x754C;&#x8303;&#x56F4;&#xFF0C;&#x7EA6;44km x 33km&#xFF0C;&#x6216;&#x7EA6;1452&#x5E73;&#x65B9;&#x516C;&#x91CC;&#xFF0C;&#x6240;&#x4EE5;&#x6211;&#x4EEC;&#x7684;&#x8FB9;&#x754C;&#x5728;&#x5B89;&#x5168;&#x8303;&#x56F4;&#x5185;&#xFF1B;&#x6211;&#x4EEC;&#x7EDD;&#x5BF9;&#x4E0D;&#x4F1A;&#x5728;&#x5185;&#x5B58;&#x4E2D;&#x521B;&#x5EFA;&#x4E86;&#x592A;&#x591A;&#x7684; buckets&#x3002;</p>
<p>&#x524D;&#x9762;&#x7684;&#x8BF7;&#x6C42;&#x54CD;&#x5E94;&#x770B;&#x8D77;&#x6765;&#x662F;&#x8FD9;&#x6837;&#x7684;&#xFF1A;</p>
<pre><code class="lang-json">...
<span class="hljs-string">&quot;aggregations&quot;</span>: {
  <span class="hljs-string">&quot;new_york&quot;</span>: {
     <span class="hljs-string">&quot;buckets&quot;</span>: [                 <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">1</span>&gt;</span>
        {
           &quot;key&quot;: &quot;dr5rs&quot;,
           &quot;doc_count&quot;: 2
        },
        {
           &quot;key&quot;: &quot;dr5re&quot;,
           &quot;doc_count&quot;: 1
        }
     ]
  }
}
...
</span></code></pre>
<blockquote>
<p> <img src="assets/1.png" alt="img">   &#x6BCF;&#x4E2A; bucket &#x5305;&#x542B;&#x4F5C;&#x4E3A; <code>key</code> &#x7684; geohash &#x503C;   </p>
</blockquote>
<p>&#x540C;&#x6837;&#xFF0C;&#x6211;&#x4EEC;&#x4E5F;&#x6CA1;&#x6709;&#x6307;&#x5B9A;&#x4EFB;&#x4F55;&#x5B50;&#x805A;&#x5408;&#xFF0C;&#x6240;&#x4EE5;&#x6211;&#x4EEC;&#x5F97;&#x5230;&#x662F;&#x6587;&#x6863;&#x8BA1;&#x6570;&#x3002;&#x5982;&#x679C;&#x9700;&#x8981;&#xFF0C;&#x6211;&#x4EEC;&#x4E5F;&#x53EF;&#x4EE5;&#x4E86;&#x89E3;&#x8FD9;&#x4E9B; buckets &#x4E2D;&#x53D7;&#x6B22;&#x8FCE;&#x7684;&#x9910;&#x5385;&#x7C7B;&#x578B;&#x3001;&#x5E73;&#x5747;&#x4EF7;&#x683C;&#x6216;&#x5176;&#x4ED6;&#x7EC6;&#x8282;&#x3002;</p>
<blockquote>
<p> <img src="assets/tip.png" alt="&#x63D0;&#x793A;">   &#x8981;&#x5728;&#x5730;&#x56FE;&#x4E0A;&#x7ED8;&#x5236;&#x8FD9;&#x4E9B; buckets&#xFF0C;&#x4F60;&#x9700;&#x8981;&#x4E00;&#x4E2A;&#x5C06; geohash &#x8F6C;&#x6362;&#x6210;&#x540C;&#x7B49;&#x8FB9;&#x754C;&#x6846;&#x6216;&#x4E2D;&#x5FC3;&#x70B9;&#x7684;&#x5E93;&#x3002;JavaScript &#x548C;&#x5176;&#x4ED6;&#x8BED;&#x8A00;&#x5DF2;&#x6709;&#x7684;&#x5E93;&#x4F1A;&#x4E3A;&#x4F60;&#x6267;&#x884C;&#x8FD9;&#x4E2A;&#x8F6C;&#x6362;&#xFF0C;&#x4F46;&#x4F60;&#x4E5F;&#x53EF;&#x4EE5;&#x4ECE;&#x4F7F;&#x7528; <a href="https://www.elastic.co/guide/cn/elasticsearch/guide/current/geo-bounds-agg.html" target="_blank">geo-bounds-agg</a>&#x7684;&#x4FE1;&#x606F;&#x6765;&#x8FDB;&#x884C;&#x7C7B;&#x4F3C;&#x7684;&#x5DE5;&#x4F5C;&#x3002;  </p>
</blockquote>
<h3 id="&#x5730;&#x7406;&#x8FB9;&#x754C;&#x805A;&#x5408;"><a name="&#x5730;&#x7406;&#x8FB9;&#x754C;&#x805A;&#x5408;" class="anchor-navigation-ex-anchor" href="#&#x5730;&#x7406;&#x8FB9;&#x754C;&#x805A;&#x5408;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5730;&#x7406;&#x8FB9;&#x754C;&#x805A;&#x5408;</h3>
<p>&#x5728;&#x6211;&#x4EEC;<a href="https://www.elastic.co/guide/cn/elasticsearch/guide/current/geohash-grid-agg.html" target="_blank">&#x4E4B;&#x524D;&#x7684;&#x4F8B;&#x5B50;</a>&#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x901A;&#x8FC7;&#x4E00;&#x4E2A;&#x8986;&#x76D6;&#x5927;&#x7EBD;&#x7EA6;&#x533A;&#x7684;&#x8FB9;&#x6846;&#x6765;&#x8FC7;&#x6EE4;&#x7ED3;&#x679C;&#x3002; &#x7136;&#x800C;&#xFF0C;&#x6211;&#x4EEC;&#x7684;&#x7ED3;&#x679C;&#x5168;&#x90E8;&#x90FD;&#x4F4D;&#x4E8E;&#x66FC;&#x54C8;&#x987F;&#x5E02;&#x4E2D;&#x5FC3;&#x3002;&#x5F53;&#x4E3A;&#x6211;&#x4EEC;&#x7684;&#x7528;&#x6237;&#x663E;&#x793A;&#x4E00;&#x4E2A;&#x5730;&#x56FE;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x653E;&#x5927;&#x5305;&#x542B;&#x6570;&#x636E;&#x7684;&#x533A;&#x57DF;&#x662F;&#x6709;&#x610F;&#x4E49;&#x7684;&#xFF1B;&#x5C55;&#x793A;&#x5927;&#x91CF;&#x7684;&#x7A7A;&#x767D;&#x7A7A;&#x95F4;&#x662F;&#x6CA1;&#x6709;&#x4EFB;&#x4F55;&#x610F;&#x4E49;&#x7684;&#x3002;</p>
<p><code>geo_bounds</code> &#x6B63;&#x597D;&#x662F;&#x8FD9;&#x6837;&#x7684;&#xFF1A;&#x5B83;&#x8BA1;&#x7B97;&#x5C01;&#x88C5;&#x6240;&#x6709;&#x5730;&#x7406;&#x4F4D;&#x7F6E;&#x70B9;&#x9700;&#x8981;&#x7684;&#x6700;&#x5C0F;&#x8FB9;&#x754C;&#x6846;&#xFF1A;</p>
<pre><code class="lang-json">GET /attractions/restaurant/_search
{
  <span class="hljs-string">&quot;size&quot;</span> : <span class="hljs-number">0</span>,
  <span class="hljs-string">&quot;query&quot;</span>: {
    <span class="hljs-string">&quot;constant_score&quot;</span>: {
      <span class="hljs-string">&quot;filter&quot;</span>: {
        <span class="hljs-string">&quot;geo_bounding_box&quot;</span>: {
          <span class="hljs-string">&quot;location&quot;</span>: {
            <span class="hljs-string">&quot;top_left&quot;</span>: {
              <span class="hljs-string">&quot;lat&quot;</span>:  <span class="hljs-number">40</span>,<span class="hljs-number">8</span>,
              <span class="hljs-string">&quot;lon&quot;</span>: <span class="hljs-number">-74.1</span>
            },
            <span class="hljs-string">&quot;bottom_right&quot;</span>: {
              <span class="hljs-string">&quot;lat&quot;</span>:  <span class="hljs-number">40.4</span>,
              <span class="hljs-string">&quot;lon&quot;</span>: <span class="hljs-number">-73.9</span>
            }
          }
        }
      }
    }
  },
  <span class="hljs-string">&quot;aggs&quot;</span>: {
    <span class="hljs-string">&quot;new_york&quot;</span>: {
      <span class="hljs-string">&quot;geohash_grid&quot;</span>: {
        <span class="hljs-string">&quot;field&quot;</span>:     <span class="hljs-string">&quot;location&quot;</span>,
        <span class="hljs-string">&quot;precision&quot;</span>: <span class="hljs-number">5</span>
      }
    },
    <span class="hljs-string">&quot;map_zoom&quot;</span>: {                        <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">1</span>&gt;</span>
      &quot;geo_bounds&quot;: {
        &quot;field&quot;:     &quot;location&quot;
      }
    }
  }
}
</span></code></pre>
<blockquote>
<p> <img src="assets/1.png" alt="img">   <code>geo_bounds</code> &#x805A;&#x5408;&#x5C06;&#x8BA1;&#x7B97;&#x5C01;&#x88C5;&#x6240;&#x6709;&#x5339;&#x914D;&#x67E5;&#x8BE2;&#x6587;&#x6863;&#x6240;&#x9700;&#x8981;&#x7684;&#x6700;&#x5C0F;&#x8FB9;&#x754C;&#x6846;&#x3002;   </p>
</blockquote>
<p>&#x54CD;&#x5E94;&#x73B0;&#x5728;&#x5305;&#x62EC;&#x4E86;&#x4E00;&#x4E2A;&#x53EF;&#x4EE5;&#x7528;&#x6765;&#x7F29;&#x653E;&#x5730;&#x56FE;&#x7684;&#x8FB9;&#x754C;&#x6846;&#x3002;</p>
<pre><code class="lang-json">...
<span class="hljs-string">&quot;aggregations&quot;</span>: {
  <span class="hljs-string">&quot;map_zoom&quot;</span>: {
     <span class="hljs-string">&quot;bounds&quot;</span>: {
        <span class="hljs-string">&quot;top_left&quot;</span>: {
           <span class="hljs-string">&quot;lat&quot;</span>:  <span class="hljs-number">40.722</span>,
           <span class="hljs-string">&quot;lon&quot;</span>: <span class="hljs-number">-74.011</span>
        },
        <span class="hljs-string">&quot;bottom_right&quot;</span>: {
           <span class="hljs-string">&quot;lat&quot;</span>:  <span class="hljs-number">40.715</span>,
           <span class="hljs-string">&quot;lon&quot;</span>: <span class="hljs-number">-73.983</span>
        }
     }
  },
...
</code></pre>
<p>&#x4E8B;&#x5B9E;&#x4E0A;&#xFF0C;&#x6211;&#x4EEC;&#x751A;&#x81F3;&#x53EF;&#x4EE5;&#x5728;&#x6BCF;&#x4E00;&#x4E2A; geohash &#x5355;&#x5143;&#x5185;&#x90E8;&#x4F7F;&#x7528; <code>geo_bounds</code> &#x805A;&#x5408;&#xFF0C; &#x4EE5;&#x514D;&#x4E00;&#x4E2A;&#x5355;&#x5143;&#x5185;&#x7684;&#x5730;&#x7406;&#x4F4D;&#x7F6E;&#x70B9;&#x4EC5;&#x96C6;&#x4E2D;&#x5728;&#x5355;&#x5143;&#x7684;&#x4E00;&#x90E8;&#x5206;&#x4E0A;&#xFF1A;</p>
<pre><code class="lang-json">GET /attractions/restaurant/_search
{
  <span class="hljs-string">&quot;size&quot;</span> : <span class="hljs-number">0</span>,
  <span class="hljs-string">&quot;query&quot;</span>: {
    <span class="hljs-string">&quot;constant_score&quot;</span>: {
      <span class="hljs-string">&quot;filter&quot;</span>: {
        <span class="hljs-string">&quot;geo_bounding_box&quot;</span>: {
          <span class="hljs-string">&quot;location&quot;</span>: {
            <span class="hljs-string">&quot;top_left&quot;</span>: {
              <span class="hljs-string">&quot;lat&quot;</span>:  <span class="hljs-number">40</span>,<span class="hljs-number">8</span>,
              <span class="hljs-string">&quot;lon&quot;</span>: <span class="hljs-number">-74.1</span>
            },
            <span class="hljs-string">&quot;bottom_right&quot;</span>: {
              <span class="hljs-string">&quot;lat&quot;</span>:  <span class="hljs-number">40.4</span>,
              <span class="hljs-string">&quot;lon&quot;</span>: <span class="hljs-number">-73.9</span>
            }
          }
        }
      }
    }
  },
  <span class="hljs-string">&quot;aggs&quot;</span>: {
    <span class="hljs-string">&quot;new_york&quot;</span>: {
      <span class="hljs-string">&quot;geohash_grid&quot;</span>: {
        <span class="hljs-string">&quot;field&quot;</span>:     <span class="hljs-string">&quot;location&quot;</span>,
        <span class="hljs-string">&quot;precision&quot;</span>: <span class="hljs-number">5</span>
      },
      <span class="hljs-string">&quot;aggs&quot;</span>: {
        <span class="hljs-string">&quot;cell&quot;</span>: {                          <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">1</span>&gt;</span>
          &quot;geo_bounds&quot;: {
            &quot;field&quot;: &quot;location&quot;
          }
        }
      }
    }
  }
}
</span></code></pre>
<blockquote>
<p> <img src="assets/1.png" alt="img">   <code>cell_bounds</code> &#x5B50;&#x805A;&#x5408;&#x4F1A;&#x4E3A;&#x6BCF;&#x4E2A; geohash &#x5355;&#x5143;&#x8BA1;&#x7B97;&#x8FB9;&#x754C;&#x6846;&#x3002;  </p>
</blockquote>
<p>&#x73B0;&#x5728;&#x5728;&#x6BCF;&#x4E2A;&#x5355;&#x5143;&#x91CC;&#x7684;&#x70B9;&#x6709;&#x4E00;&#x4E2A;&#x8FB9;&#x754C;&#x6846;&#x3002;</p>
<pre><code class="lang-json">...
<span class="hljs-string">&quot;aggregations&quot;</span>: {
  <span class="hljs-string">&quot;new_york&quot;</span>: {
     <span class="hljs-string">&quot;buckets&quot;</span>: [
        {
           <span class="hljs-string">&quot;key&quot;</span>: <span class="hljs-string">&quot;dr5rs&quot;</span>,
           <span class="hljs-string">&quot;doc_count&quot;</span>: <span class="hljs-number">2</span>,
           <span class="hljs-string">&quot;cell&quot;</span>: {
              <span class="hljs-string">&quot;bounds&quot;</span>: {
                 <span class="hljs-string">&quot;top_left&quot;</span>: {
                    <span class="hljs-string">&quot;lat&quot;</span>:  <span class="hljs-number">40.722</span>,
                    <span class="hljs-string">&quot;lon&quot;</span>: <span class="hljs-number">-73.989</span>
                 },
                 <span class="hljs-string">&quot;bottom_right&quot;</span>: {
                    <span class="hljs-string">&quot;lat&quot;</span>:  <span class="hljs-number">40.719</span>,
                    <span class="hljs-string">&quot;lon&quot;</span>: <span class="hljs-number">-73.983</span>
                 }
              }
           }
        },
...
</code></pre>
<h2 id="&#x5730;&#x7406;&#x5F62;&#x72B6;"><a name="&#x5730;&#x7406;&#x5F62;&#x72B6;" class="anchor-navigation-ex-anchor" href="#&#x5730;&#x7406;&#x5F62;&#x72B6;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5730;&#x7406;&#x5F62;&#x72B6;</h2>
<p>&#x5730;&#x7406;&#x5F62;&#x72B6;&#xFF08; Geo-shapes &#xFF09;&#x4F7F;&#x7528;&#x4E00;&#x79CD;&#x4E0E;&#x5730;&#x7406;&#x5750;&#x6807;&#x70B9;&#x5B8C;&#x5168;&#x4E0D;&#x540C;&#x7684;&#x65B9;&#x6CD5;&#x3002;&#x6211;&#x4EEC;&#x5728;&#x8BA1;&#x7B97;&#x673A;&#x5C4F;&#x5E55;&#x4E0A;&#x770B;&#x5230;&#x7684;&#x5706;&#x5F62;&#x5E76;&#x4E0D;&#x662F;&#x7531;&#x5B8C;&#x7F8E;&#x7684;&#x8FDE;&#x7EED;&#x7684;&#x7EBF;&#x7EC4;&#x6210;&#x7684;&#x3002;&#x800C;&#x662F;&#x7528;&#x4E00;&#x4E2A;&#x4E2A;&#x8FDE;&#x7EED;&#x7684;&#x7740;&#x8272;&#x50CF;&#x7D20;&#x70B9;&#x753B;&#x51FA;&#x7684;&#x4E00;&#x4E2A;&#x8FD1;&#x4F3C;&#x5706;&#x3002;&#x5730;&#x7406;&#x5F62;&#x72B6;&#x7684;&#x5DE5;&#x4F5C;&#x65B9;&#x5F0F;&#x5C31;&#x4E0E;&#x6B64;&#x76F8;&#x4F3C;&#x3002;</p>
<p>&#x590D;&#x6742;&#x7684;&#x5F62;&#x72B6;&#x2014;&#x2014;&#x6BD4;&#x5982;&#x70B9;&#x96C6;&#x3001;&#x7EBF;&#x3001;&#x591A;&#x8FB9;&#x5F62;&#x3001;&#x591A;&#x591A;&#x8FB9;&#x5F62;&#x3001;&#x4E2D;&#x7A7A;&#x591A;&#x8FB9;&#x5F62;&#x2014;&#x2014;&#x90FD;&#x662F;&#x901A;&#x8FC7; geohash &#x5355;&#x5143; &#x201C;&#x753B;&#x51FA;&#x6765;&#x201D; &#x7684;&#xFF0C;&#x8FD9;&#x4E9B;&#x5F62;&#x72B6;&#x4F1A;&#x8F6C;&#x5316;&#x4E3A;&#x4E00;&#x4E2A;&#x88AB;&#x5B83;&#x6240;&#x8986;&#x76D6;&#x5230;&#x7684; geohash &#x7684;&#x96C6;&#x5408;&#x3002;</p>
<blockquote>
<p> <img src="assets/note.png" alt="&#x6CE8;&#x610F;">  &#x5B9E;&#x9645;&#x4E0A;&#xFF0C;&#x4E24;&#x79CD;&#x7C7B;&#x578B;&#x7684;&#x7F51;&#x683C;&#x53EF;&#x4EE5;&#x88AB;&#x7528;&#x4E8E; geo-shapes&#xFF1A;&#x9ED8;&#x8BA4;&#x4F7F;&#x7528;&#x6211;&#x4EEC;&#x4E4B;&#x524D;&#x8BA8;&#x8BBA;&#x8FC7;&#x7684; geohash &#xFF0C;&#x53E6;&#x5916;&#x8FD8;&#x6709;&#x4E00;&#x79CD;&#x662F; <em>&#x56DB;&#x53C9;&#x6811;</em> &#x3002;&#x56DB;&#x53C9;&#x6811;&#x4E0E; geohash &#x7C7B;&#x4F3C;&#xFF0C;&#x9664;&#x4E86;&#x56DB;&#x53C9;&#x6811;&#x6BCF;&#x4E2A;&#x5C42;&#x7EA7;&#x53EA;&#x6709; 4 &#x4E2A;&#x5355;&#x5143;&#xFF0C;&#x800C;&#x4E0D;&#x662F; 32 &#x3002;&#x8FD9;&#x79CD;&#x4E0D;&#x540C;&#x53D6;&#x51B3;&#x4E8E;&#x7F16;&#x7801;&#x65B9;&#x5F0F;&#x7684;&#x9009;&#x62E9;&#x3002;</p>
</blockquote>
<p>&#x7EC4;&#x6210;&#x4E00;&#x4E2A;&#x5F62;&#x72B6;&#x7684; geohash &#x90FD;&#x4F5C;&#x4E3A;&#x4E00;&#x4E2A;&#x5355;&#x5143;&#x88AB;&#x7D22;&#x5F15;&#x5728;&#x4E00;&#x8D77;&#x3002;&#x6709;&#x4E86;&#x8FD9;&#x4E9B;&#x4FE1;&#x606F;&#xFF0C;&#x901A;&#x8FC7;&#x67E5;&#x770B;&#x662F;&#x5426;&#x6709;&#x76F8;&#x540C;&#x7684; geohash &#x5355;&#x5143;&#xFF0C;&#x5C31;&#x53EF;&#x4EE5;&#x5F88;&#x8F7B;&#x6613;&#x5730;&#x68C0;&#x67E5;&#x4E24;&#x4E2A;&#x5F62;&#x72B6;&#x662F;&#x5426;&#x6709;&#x4EA4;&#x96C6;&#x3002;</p>
<p>geo-shapes &#x6709;&#x4EE5;&#x4E0B;&#x4F5C;&#x7528;&#xFF1A;&#x5224;&#x65AD;&#x67E5;&#x8BE2;&#x7684;&#x5F62;&#x72B6;&#x4E0E;&#x7D22;&#x5F15;&#x7684;&#x5F62;&#x72B6;&#x7684;&#x5173;&#x7CFB;&#xFF1B;&#x8FD9;&#x4E9B; <code>&#x5173;&#x7CFB;</code> &#x53EF;&#x80FD;&#x662F;&#x4EE5;&#x4E0B;&#x4E4B;&#x4E00;&#xFF1A;</p>
<ul>
<li><p><code>intersects</code></p>
<p>&#x67E5;&#x8BE2;&#x7684;&#x5F62;&#x72B6;&#x4E0E;&#x7D22;&#x5F15;&#x7684;&#x5F62;&#x72B6;&#x6709;&#x91CD;&#x53E0;&#xFF08;&#x9ED8;&#x8BA4;&#xFF09;&#x3002;</p>
</li>
<li><p><code>disjoint</code></p>
<p>&#x67E5;&#x8BE2;&#x7684;&#x5F62;&#x72B6;&#x4E0E;&#x7D22;&#x5F15;&#x7684;&#x5F62;&#x72B6;&#x5B8C;&#x5168; <em>&#x4E0D;</em> &#x91CD;&#x53E0;&#x3002;</p>
</li>
<li><p><code>within</code></p>
<p>&#x7D22;&#x5F15;&#x7684;&#x5F62;&#x72B6;&#x5B8C;&#x5168;&#x88AB;&#x5305;&#x542B;&#x5728;&#x67E5;&#x8BE2;&#x7684;&#x5F62;&#x72B6;&#x4E2D;&#x3002;</p>
</li>
</ul>
<p>Geo-shapes &#x4E0D;&#x80FD;&#x7528;&#x4E8E;&#x8BA1;&#x7B97;&#x8DDD;&#x79BB;&#x3001;&#x6392;&#x5E8F;&#x3001;&#x6253;&#x5206;&#x4EE5;&#x53CA;&#x805A;&#x5408;&#x3002;</p>
<h3 id="&#x6620;&#x5C04;&#x5730;&#x7406;&#x5F62;&#x72B6;"><a name="&#x6620;&#x5C04;&#x5730;&#x7406;&#x5F62;&#x72B6;" class="anchor-navigation-ex-anchor" href="#&#x6620;&#x5C04;&#x5730;&#x7406;&#x5F62;&#x72B6;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x6620;&#x5C04;&#x5730;&#x7406;&#x5F62;&#x72B6;</h3>
<p>&#x4E0E; <code>geo_point</code> &#x7C7B;&#x578B;&#x7684;&#x5B57;&#x6BB5;&#x76F8;&#x4F3C;&#xFF0C; &#x5730;&#x7406;&#x5F62;&#x72B6; &#x4E5F;&#x5FC5;&#x987B;&#x5728;&#x4F7F;&#x7528;&#x524D;&#x660E;&#x786E;&#x6620;&#x5C04;&#xFF1A;</p>
<pre><code class="lang-json">PUT /attractions
{
  <span class="hljs-string">&quot;mappings&quot;</span>: {
    <span class="hljs-string">&quot;landmark&quot;</span>: {
      <span class="hljs-string">&quot;properties&quot;</span>: {
        <span class="hljs-string">&quot;name&quot;</span>: {
          <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>
        },
        <span class="hljs-string">&quot;location&quot;</span>: {
          <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;geo_shape&quot;</span>
        }
      }
    }
  }
}
</code></pre>
<p>&#x4F60;&#x9700;&#x8981;&#x8003;&#x8651;&#x4FEE;&#x6539;&#x4E24;&#x4E2A;&#x975E;&#x5E38;&#x91CD;&#x8981;&#x7684;&#x8BBE;&#x7F6E;&#xFF1A; <code>&#x7CBE;&#x5EA6;</code> &#x548C; <code>&#x8DDD;&#x79BB;&#x8BEF;&#x5DEE;</code> &#x3002;</p>
<p><strong>&#x7CBE;&#x5EA6;</strong></p>
<p><code>&#x7CBE;&#x5EA6;</code> &#xFF08; <code>precision</code> &#xFF09;&#x53C2;&#x6570; &#x7528;&#x6765;&#x63A7;&#x5236;&#x751F;&#x6210;&#x7684; geohash &#x7684;&#x6700;&#x5927;&#x957F;&#x5EA6;&#x3002;&#x9ED8;&#x8BA4;&#x7CBE;&#x5EA6;&#x4E3A; <code>9</code> &#xFF0C;&#x7B49;&#x540C;&#x4E8E;&#x5C3A;&#x5BF8;&#x5728; 5m x 5m &#x7684;<a href="https://www.elastic.co/guide/cn/elasticsearch/guide/current/geohashes.html" target="_blank">geohash</a> &#x3002;&#x8FD9;&#x4E2A;&#x7CBE;&#x5EA6;&#x53EF;&#x80FD;&#x6BD4;&#x4F60;&#x9700;&#x8981;&#x7684;&#x7CBE;&#x786E;&#x5F97;&#x591A;&#x3002;</p>
<p>&#x7CBE;&#x5EA6;&#x8D8A;&#x4F4E;&#xFF0C;&#x9700;&#x8981;&#x7D22;&#x5F15;&#x7684;&#x5355;&#x5143;&#x5C31;&#x8D8A;&#x5C11;&#xFF0C;&#x68C0;&#x7D22;&#x65F6;&#x4E5F;&#x4F1A;&#x66F4;&#x5FEB;&#x3002;&#x5F53;&#x7136;&#xFF0C;&#x7CBE;&#x5EA6;&#x8D8A;&#x4F4E;&#xFF0C;&#x5730;&#x7406;&#x5F62;&#x72B6;&#x7684;&#x51C6;&#x786E;&#x6027;&#x5C31;&#x8D8A;&#x5DEE;&#x3002;&#x4F60;&#x9700;&#x8981;&#x8003;&#x8651;&#x81EA;&#x5DF1;&#x7684;&#x5730;&#x7406;&#x5F62;&#x72B6;&#x6240;&#x9700;&#x8981;&#x7684;&#x7CBE;&#x5EA6;&#x2014;&#x2014;&#x5373;&#x4F7F;&#x51CF;&#x5C11;1-2&#x4E2A;&#x7B49;&#x7EA7;&#x7684;&#x7CBE;&#x5EA6;&#x4E5F;&#x80FD;&#x5E26;&#x6765;&#x660E;&#x663E;&#x7684;&#x6D88;&#x8017;&#x7F29;&#x51CF;&#x6536;&#x76CA;&#x3002;</p>
<p>&#x4F60;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x8DDD;&#x79BB;&#x6765;&#x6307;&#x5B9A;&#x7CBE;&#x5EA6; &#x2014;&#x2014; &#x5982; <code>50m</code> &#x6216; <code>2km</code>&#x2014;&#x4E0D;&#x8FC7;&#x8FD9;&#x4E9B;&#x8DDD;&#x79BB;&#x6700;&#x7EC8;&#x4E5F;&#x4F1A;&#x8F6C;&#x6362;&#x6210;&#x5BF9;&#x5E94;&#x7684;<a href="https://www.elastic.co/guide/cn/elasticsearch/guide/current/geohashes.html" target="_blank"><em>Geohashes</em></a>&#x7B49;&#x7EA7;&#x3002;</p>
<p><strong>&#x8DDD;&#x79BB;&#x8BEF;&#x5DEE;</strong></p>
<p>&#x5F53;&#x7D22;&#x5F15;&#x4E00;&#x4E2A;&#x591A;&#x8FB9;&#x5F62;&#x65F6;&#xFF0C;&#x4E2D;&#x95F4;&#x8FDE;&#x7EED;&#x533A;&#x57DF;&#x5F88;&#x5BB9;&#x6613;&#x7528;&#x4E00;&#x4E2A;&#x77ED; geohash &#x6765;&#x8868;&#x793A;&#x3002; &#x9EBB;&#x70E6;&#x7684;&#x662F;&#x8FB9;&#x7F18;&#x90E8;&#x5206;&#xFF0C;&#x8FD9;&#x4E9B;&#x5730;&#x65B9;&#x9700;&#x8981;&#x4F7F;&#x7528;&#x66F4;&#x7CBE;&#x7EC6;&#x7684; geohashes &#x624D;&#x80FD;&#x8868;&#x793A;&#x3002;</p>
<p>&#x5F53;&#x4F60;&#x5728;&#x7D22;&#x5F15;&#x4E00;&#x4E2A;&#x5C0F;&#x5730;&#x6807;&#x65F6;&#xFF0C;&#x4F60;&#x4F1A;&#x5E0C;&#x671B;&#x5B83;&#x7684;&#x8FB9;&#x754C;&#x6BD4;&#x8F83;&#x7CBE;&#x786E;&#x3002;&#x8BA9;&#x8FD9;&#x4E9B;&#x7EAA;&#x5FF5;&#x7891;&#x4E00;&#x4E2A;&#x53E0;&#x7740;&#x4E00;&#x4E2A;&#x53EF;&#x4E0D;&#x597D;&#x3002;&#x5F53;&#x7D22;&#x5F15;&#x6574;&#x4E2A;&#x56FD;&#x5BB6;&#x65F6;&#xFF0C;&#x4F60;&#x5C31;&#x4E0D;&#x9700;&#x8981;&#x8FD9;&#x4E48;&#x9AD8;&#x7684;&#x7CBE;&#x5EA6;&#x4E86;&#x3002;&#x8BEF;&#x5DEE;&#x4E2A;50&#x7C73;&#x5DE6;&#x53F3;&#x4E5F;&#x4E0D;&#x53EF;&#x80FD;&#x5F15;&#x53D1;&#x6218;&#x4E89;&#x3002;</p>
<p><code>&#x8DDD;&#x79BB;&#x8BEF;&#x5DEE;</code> &#x6307;&#x5B9A;&#x5730;&#x7406;&#x5F62;&#x72B6;&#x53EF;&#x4EE5;&#x63A5;&#x53D7;&#x7684;&#x6700;&#x5927;&#x9519;&#x8BEF;&#x7387;&#x3002;&#x5B83;&#x7684;&#x9ED8;&#x8BA4;&#x503C;&#x662F; <code>0.025</code> &#xFF0C; &#x5373; 2.5% &#x3002;&#x4E5F;&#x5C31;&#x662F;&#x8BF4;&#xFF0C;&#x5927;&#x7684;&#x5730;&#x7406;&#x5F62;&#x72B6;&#xFF08;&#x6BD4;&#x5982;&#x56FD;&#x5BB6;&#xFF09;&#x76F8;&#x6BD4;&#x5C0F;&#x7684;&#x5730;&#x7406;&#x5F62;&#x72B6;&#xFF08;&#x6BD4;&#x5982;&#x7EAA;&#x5FF5;&#x7891;&#xFF09;&#x6765;&#x8BF4;&#xFF0C;&#x5BB9;&#x8BB8;&#x66F4;&#x52A0;&#x6A21;&#x7CCA;&#x7684;&#x8FB9;&#x754C;&#x3002;</p>
<p><code>0.025</code> &#x662F;&#x4E00;&#x4E2A;&#x4E0D;&#x9519;&#x7684;&#x521D;&#x59CB;&#x503C;&#x3002;&#x4E0D;&#x8FC7;&#x5982;&#x679C;&#x6211;&#x4EEC;&#x5BB9;&#x8BB8;&#x66F4;&#x5927;&#x7684;&#x9519;&#x8BEF;&#x7387;&#xFF0C;&#x5BF9;&#x5E94;&#x5730;&#x7406;&#x5F62;&#x72B6;&#x9700;&#x8981;&#x7D22;&#x5F15;&#x7684;&#x5355;&#x5143;&#x5C31;&#x8D8A;&#x5C11;&#x3002;</p>
<h3 id="&#x7D22;&#x5F15;&#x5730;&#x7406;&#x5F62;&#x72B6;"><a name="&#x7D22;&#x5F15;&#x5730;&#x7406;&#x5F62;&#x72B6;" class="anchor-navigation-ex-anchor" href="#&#x7D22;&#x5F15;&#x5730;&#x7406;&#x5F62;&#x72B6;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x7D22;&#x5F15;&#x5730;&#x7406;&#x5F62;&#x72B6;</h3>
<p>&#x5730;&#x7406;&#x5F62;&#x72B6;&#x901A;&#x8FC7; <a href="http://geojson.org/" target="_blank">GeoJSON</a> &#x6765;&#x8868;&#x793A;&#xFF0C;&#x8FD9;&#x662F;&#x4E00;&#x79CD;&#x5F00;&#x653E;&#x7684;&#x4F7F;&#x7528; JSON &#x5B9E;&#x73B0;&#x7684;&#x4E8C;&#x7EF4;&#x5F62;&#x72B6;&#x7F16;&#x7801;&#x65B9;&#x5F0F;&#x3002; &#x6BCF;&#x4E2A;&#x5F62;&#x72B6;&#x90FD;&#x5305;&#x542B;&#x4E86;&#x5F62;&#x72B6;&#x7C7B;&#x578B;&#x2014; <code>point</code>, <code>line</code>, <code>polygon</code>, <code>envelope</code> &#x2014;&#x548C;&#x4E00;&#x4E2A;&#x6216;&#x591A;&#x4E2A;&#x7ECF;&#x7EAC;&#x5EA6;&#x70B9;&#x96C6;&#x5408;&#x7684;&#x6570;&#x7EC4;&#x3002;</p>
<blockquote>
<p> <img src="assets/caution.png" alt="&#x5C0F;&#x5FC3;">  &#x5728; GeoJSON &#x91CC;&#xFF0C;&#x7ECF;&#x7EAC;&#x5EA6;&#x8868;&#x793A;&#x65B9;&#x5F0F;&#x901A;&#x5E38;&#x662F; <em>&#x7EAC;&#x5EA6;</em> &#x5728;&#x524D;&#xFF0C; <em>&#x7ECF;&#x5EA6;</em> &#x5728;&#x540E;&#x3002;  </p>
</blockquote>
<p>&#x5982;&#xFF0C;&#x6211;&#x4EEC;&#x7528;&#x4E00;&#x4E2A;&#x591A;&#x8FB9;&#x5F62;&#x6765;&#x7D22;&#x5F15;&#x963F;&#x59C6;&#x65AF;&#x7279;&#x4E39;&#x8FBE;&#x59C6;&#x5E7F;&#x573A;&#xFF1A;</p>
<pre><code class="lang-json">PUT /attractions/landmark/dam_square
{
    <span class="hljs-string">&quot;name&quot;</span> : <span class="hljs-string">&quot;Dam Square, Amsterdam&quot;</span>,
    <span class="hljs-string">&quot;location&quot;</span> : {
        <span class="hljs-string">&quot;type&quot;</span> : <span class="hljs-string">&quot;polygon&quot;</span>, 
        <span class="hljs-string">&quot;coordinates&quot;</span> : [[ 
          [ <span class="hljs-number">4.89218</span>, <span class="hljs-number">52.37356</span> ],
          [ <span class="hljs-number">4.89205</span>, <span class="hljs-number">52.37276</span> ],
          [ <span class="hljs-number">4.89301</span>, <span class="hljs-number">52.37274</span> ],
          [ <span class="hljs-number">4.89392</span>, <span class="hljs-number">52.37250</span> ],
          [ <span class="hljs-number">4.89431</span>, <span class="hljs-number">52.37287</span> ],
          [ <span class="hljs-number">4.89331</span>, <span class="hljs-number">52.37346</span> ],
          [ <span class="hljs-number">4.89305</span>, <span class="hljs-number">52.37326</span> ],
          [ <span class="hljs-number">4.89218</span>, <span class="hljs-number">52.37356</span> ]
        ]]
    }
}
</code></pre>
<table>
<thead>
<tr>
<th><a href="https://www.elastic.co/guide/cn/elasticsearch/guide/current/indexing-geo-shapes.html#CO244-1" target="_blank"><img src="assets/1-1552025856795.png" alt="img"></a></th>
<th><code>type</code> &#x53C2;&#x6570;&#x6307;&#x660E;&#x4E86;&#x7ECF;&#x7EAC;&#x5EA6;&#x5750;&#x6807;&#x96C6;&#x8868;&#x793A;&#x7684;&#x5F62;&#x72B6;&#x7C7B;&#x578B;&#x3002;</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="https://www.elastic.co/guide/cn/elasticsearch/guide/current/indexing-geo-shapes.html#CO244-2" target="_blank"><img src="assets/2-1552025857217.png" alt="img"></a></td>
<td><code>lon/lat</code> &#x5217;&#x8868;&#x63CF;&#x8FF0;&#x4E86;&#x591A;&#x8FB9;&#x5F62;&#x7684;&#x5F62;&#x72B6;&#x3002;</td>
</tr>
</tbody>
</table>
<p>&#x4E0A;&#x4F8B;&#x4E2D;&#x5927;&#x91CF;&#x7684;&#x65B9;&#x62EC;&#x53F7;&#x53EF;&#x80FD;&#x770B;&#x8D77;&#x6765;&#x8BA9;&#x4EBA;&#x56F0;&#x60D1;&#xFF0C;&#x4E0D;&#x8FC7;&#x5B9E;&#x9645;&#x4E0A; GeoJSON &#x7684;&#x8BED;&#x6CD5;&#x975E;&#x5E38;&#x7B80;&#x5355;&#xFF1A;</p>
<ol>
<li><p>&#x7528;&#x4E00;&#x4E2A;&#x6570;&#x7EC4;&#x8868;&#x793A; <code>&#x7ECF;&#x7EAC;&#x5EA6;</code> &#x5750;&#x6807;&#x70B9;&#xFF1A;</p>
<pre><code>[lon,lat]
</code></pre></li>
<li><p>&#x4E00;&#x7EC4;&#x5750;&#x6807;&#x70B9;&#x653E;&#x5230;&#x4E00;&#x4E2A;&#x6570;&#x7EC4;&#x6765;&#x8868;&#x793A;&#x4E00;&#x4E2A;&#x591A;&#x8FB9;&#x5F62;&#xFF1A;</p>
<pre><code>[[lon,lat],[lon,lat], ... ]
</code></pre></li>
<li><p>&#x4E00;&#x4E2A;&#x591A;&#x8FB9;&#x5F62;&#xFF08; <code>polygon</code> &#xFF09;&#x5F62;&#x72B6;&#x53EF;&#x4EE5;&#x5305;&#x542B;&#x591A;&#x4E2A;&#x591A;&#x8FB9;&#x5F62;&#xFF1B;&#x7B2C;&#x4E00;&#x4E2A;&#x8868;&#x793A;&#x591A;&#x8FB9;&#x5F62;&#x7684;&#x5916;&#x8F6E;&#x5ED3;&#xFF0C;&#x540E;&#x7EED;&#x7684;&#x591A;&#x8FB9;&#x5F62;&#x8868;&#x793A;&#x7B2C;&#x4E00;&#x4E2A;&#x591A;&#x8FB9;&#x5F62;&#x5185;&#x90E8;&#x7684;&#x7A7A;&#x6D1E;&#xFF1A;</p>
<pre><code>[
  [[lon,lat],[lon,lat], ... ],  # main polygon
  [[lon,lat],[lon,lat], ... ],  # hole in main polygon
  ...
]
</code></pre></li>
</ol>
<p>&#x53C2;&#x89C1; <a href="https://www.elastic.co/guide/en/elasticsearch/reference/5.6/geo-shape.html" target="_blank">Geo-shape mapping documentation</a> &#x4E86;&#x89E3;&#x66F4;&#x591A;&#x652F;&#x6301;&#x7684;&#x5F62;&#x72B6;&#x3002;</p>
<h3 id="&#x67E5;&#x8BE2;&#x5730;&#x7406;&#x5F62;&#x72B6;"><a name="&#x67E5;&#x8BE2;&#x5730;&#x7406;&#x5F62;&#x72B6;" class="anchor-navigation-ex-anchor" href="#&#x67E5;&#x8BE2;&#x5730;&#x7406;&#x5F62;&#x72B6;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x67E5;&#x8BE2;&#x5730;&#x7406;&#x5F62;&#x72B6;</h3>
<p><a href="https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl-geo-shape-query.html" target="_blank"><code>geo_shape</code> &#x67E5;&#x8BE2;</a>&#x4E0D;&#x5BFB;&#x5E38;&#x7684;&#x5730;&#x65B9;&#x5728;&#x4E8E;&#xFF0C;&#x5B83;&#x5141;&#x8BB8;&#x6211;&#x4EEC;&#x4F7F;&#x7528;&#x5F62;&#x72B6;&#x6765;&#x505A;&#x67E5;&#x8BE2;&#xFF0C;&#x800C;&#x4E0D;&#x4EC5;&#x4EC5;&#x662F;&#x5750;&#x6807;&#x70B9;&#x3002;</p>
<p>&#x4E3E;&#x4E2A;&#x4F8B;&#x5B50;&#xFF0C;&#x5F53;&#x6211;&#x4EEC;&#x7684;&#x7528;&#x6237;&#x521A;&#x521A;&#x8FC8;&#x51FA;&#x963F;&#x59C6;&#x65AF;&#x7279;&#x4E39;&#x4E2D;&#x592E;&#x706B;&#x8F66;&#x7AD9;&#x65F6;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x7528;&#x5982;&#x4E0B;&#x65B9;&#x5F0F;&#xFF0C;&#x67E5;&#x8BE2;&#x51FA;&#x65B9;&#x5706; 1km &#x5185;&#x7684;&#x6240;&#x6709;&#x5730;&#x6807;&#xFF1A;</p>
<pre><code class="lang-json">GET /attractions/landmark/_search
{
  <span class="hljs-string">&quot;query&quot;</span>: {
    <span class="hljs-string">&quot;geo_shape&quot;</span>: {
      <span class="hljs-string">&quot;location&quot;</span>: {                &lt;1&gt;
        &quot;shape&quot;: {                 &lt;2&gt;
          &quot;type&quot;:   &quot;circle&quot;,      &lt;3&gt;
          &quot;radius&quot;: &quot;1km&quot;,
          &quot;coordinates&quot;: [         &lt;4&gt;
            4.89994,
            52.37815
          ]
        }
      }
    }
  }
}
</code></pre>
<blockquote>
<p> <img src="assets/1.png" alt="img">  &#x67E5;&#x8BE2;&#x4F7F;&#x7528; <code>location</code> &#x5B57;&#x6BB5;&#x4E2D;&#x7684;&#x5730;&#x7406;&#x5F62;&#x72B6;&#x3002;  </p>
<p> <img src="assets/2.png" alt="img">  &#x67E5;&#x8BE2;&#x4E2D;&#x7684;&#x5F62;&#x72B6;&#x662F;&#x7531; <code>shape</code> &#x952E;&#x5BF9;&#x5E94;&#x7684;&#x5185;&#x5BB9;&#x8868;&#x793A;&#x3002;  </p>
<p> <img src="assets/3.png" alt="img">  &#x5F62;&#x72B6;&#x662F;&#x4E00;&#x4E2A;&#x534A;&#x5F84;&#x4E3A; 1km &#x7684;&#x5706;&#x5F62;&#x3002;  </p>
<p> <img src="assets/4.png" alt="img">  &#x5B89;&#x59C6;&#x65AF;&#x7279;&#x4E39;&#x4E2D;&#x592E;&#x706B;&#x8F66;&#x7AD9;&#x5165;&#x53E3;&#x7684;&#x5750;&#x6807;&#x70B9;&#x3002;   </p>
</blockquote>
<p>&#x9ED8;&#x8BA4;&#x7684;&#xFF0C;&#x67E5;&#x8BE2;&#xFF08;&#x6216;&#x8005;&#x8FC7;&#x6EE4;&#x5668; &#x2014;&#x2014; &#x5DE5;&#x4F5C;&#x65B9;&#x5F0F;&#x76F8;&#x540C;&#xFF09;&#x4F1A;&#x4ECE;&#x5DF2;&#x7D22;&#x5F15;&#x7684;&#x5F62;&#x72B6;&#x4E2D;&#x5BFB;&#x627E;&#x4E0E;&#x6307;&#x5B9A;&#x5F62;&#x72B6;&#x6709;&#x4EA4;&#x96C6;&#x7684;&#x90E8;&#x5206;&#x3002; &#x6B64;&#x5916;&#xFF0C;&#x53EF;&#x4EE5;&#x628A; <code>relation</code> &#x5B57;&#x6BB5;&#x8BBE;&#x7F6E;&#x4E3A; <code>disjoint</code> &#x6765;&#x67E5;&#x627E;&#x4E0E;&#x6307;&#x5B9A;&#x5F62;&#x72B6;&#x4E0D;&#x76F8;&#x4EA4;&#x7684;&#x90E8;&#x5206;&#xFF0C;&#x6216;&#x8005;&#x8BBE;&#x7F6E;&#x4E3A; <code>within</code> &#x6765;&#x67E5;&#x627E;&#x5B8C;&#x5168;&#x843D;&#x5728;&#x67E5;&#x8BE2;&#x5F62;&#x72B6;&#x4E2D;&#x7684;&#x3002;</p>
<p>&#x4E3E;&#x4E2A;&#x4F8B;&#x5B50;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x67E5;&#x627E;&#x963F;&#x59C6;&#x65AF;&#x7279;&#x4E39;&#x4E2D;&#x5FC3;&#x533A;&#x57DF;&#x6240;&#x6709;&#x7684;&#x5730;&#x6807;&#xFF1A;</p>
<pre><code class="lang-json">GET /attractions/landmark/_search
{
  <span class="hljs-string">&quot;query&quot;</span>: {
    <span class="hljs-string">&quot;geo_shape&quot;</span>: {
      <span class="hljs-string">&quot;location&quot;</span>: {
        <span class="hljs-string">&quot;relation&quot;</span>: <span class="hljs-string">&quot;within&quot;</span>,            &lt;1&gt;
        &quot;shape&quot;: {
          &quot;type&quot;: &quot;polygon&quot;,
          &quot;coordinates&quot;: [[              &lt;2&gt;
              [4.88330,52.38617],
              [4.87463,52.37254],
              [4.87875,52.36369],
              [4.88939,52.35850],
              [4.89840,52.35755],
              [4.91909,52.36217],
              [4.92656,52.36594],
              [4.93368,52.36615],
              [4.93342,52.37275],
              [4.92690,52.37632],
              [4.88330,52.38617]
            ]]
        }
      }
    }
  }
}
</code></pre>
<blockquote>
<p> <img src="assets/1.png" alt="img">  &#x53EA;&#x5339;&#x914D;&#x5B8C;&#x5168;&#x843D;&#x5728;&#x67E5;&#x8BE2;&#x5F62;&#x72B6;&#x4E2D;&#x7684;&#x5DF2;&#x7D22;&#x5F15;&#x7684;&#x5F62;&#x72B6;&#x3002;   </p>
<p> <img src="assets/2.png" alt="img">  &#x8FD9;&#x4E2A;&#x591A;&#x8FB9;&#x5F62;&#x8868;&#x793A;&#x5B89;&#x59C6;&#x65AF;&#x7279;&#x4E39;&#x4E2D;&#x5FC3;&#x533A;&#x57DF;&#x3002;     </p>
</blockquote>
<h3 id="&#x5728;&#x67E5;&#x8BE2;&#x4E2D;&#x4F7F;&#x7528;&#x5DF2;&#x7D22;&#x5F15;&#x7684;&#x5F62;&#x72B6;"><a name="&#x5728;&#x67E5;&#x8BE2;&#x4E2D;&#x4F7F;&#x7528;&#x5DF2;&#x7D22;&#x5F15;&#x7684;&#x5F62;&#x72B6;" class="anchor-navigation-ex-anchor" href="#&#x5728;&#x67E5;&#x8BE2;&#x4E2D;&#x4F7F;&#x7528;&#x5DF2;&#x7D22;&#x5F15;&#x7684;&#x5F62;&#x72B6;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5728;&#x67E5;&#x8BE2;&#x4E2D;&#x4F7F;&#x7528;&#x5DF2;&#x7D22;&#x5F15;&#x7684;&#x5F62;&#x72B6;</h3>
<p>&#x5BF9;&#x4E8E;&#x90A3;&#x4E9B;&#x7ECF;&#x5E38;&#x4F1A;&#x5728;&#x67E5;&#x8BE2;&#x4E2D;&#x4F7F;&#x7528;&#x7684;&#x5F62;&#x72B6;&#xFF0C;&#x53EF;&#x4EE5;&#x628A;&#x5B83;&#x4EEC;&#x7D22;&#x5F15;&#x8D77;&#x6765;&#x4EE5;&#x4FBF;&#x5728;&#x67E5;&#x8BE2;&#x4E2D;&#x53EF;&#x4EE5;&#x65B9;&#x4FBF;&#x5730;&#x76F4;&#x63A5;&#x5F15;&#x7528;&#x540D;&#x5B57;&#x3002; &#x4EE5;&#x4E4B;&#x524D;&#x7684;&#x963F;&#x59C6;&#x65AF;&#x7279;&#x4E39;&#x4E2D;&#x90E8;&#x4E3A;&#x4F8B;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x628A;&#x5B83;&#x5B58;&#x50A8;&#x6210;&#x4E00;&#x4E2A;&#x7C7B;&#x578B;&#x4E3A; <code>neighborhood</code> &#x7684;&#x6587;&#x6863;&#x3002;</p>
<p>&#x9996;&#x5148;&#xFF0C;&#x6211;&#x4EEC;&#x4EFF;&#x7167;&#x4E4B;&#x524D;&#x8BBE;&#x7F6E; <code>landmark</code> &#x65F6;&#x7684;&#x65B9;&#x5F0F;&#x5EFA;&#x7ACB;&#x6620;&#x5C04;&#xFF1A;</p>
<pre><code class="lang-json">PUT /attractions/_mapping/neighborhood
{
  <span class="hljs-string">&quot;properties&quot;</span>: {
    <span class="hljs-string">&quot;name&quot;</span>: {
      <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>
    },
    <span class="hljs-string">&quot;location&quot;</span>: {
      <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;geo_shape&quot;</span>
    }
  }
}
</code></pre>
<p>&#x7136;&#x540E;&#x6211;&#x4EEC;&#x7D22;&#x5F15;&#x963F;&#x59C6;&#x65AF;&#x7279;&#x4E39;&#x4E2D;&#x90E8;&#x5BF9;&#x5E94;&#x7684;&#x5F62;&#x72B6;&#xFF1A;</p>
<pre><code class="lang-json">PUT /attractions/neighborhood/central_amsterdam
{
  <span class="hljs-string">&quot;name&quot;</span> : <span class="hljs-string">&quot;Central Amsterdam&quot;</span>,
  <span class="hljs-string">&quot;location&quot;</span> : {
      <span class="hljs-string">&quot;type&quot;</span> : <span class="hljs-string">&quot;polygon&quot;</span>,
      <span class="hljs-string">&quot;coordinates&quot;</span> : [[
        [<span class="hljs-number">4.88330</span>,<span class="hljs-number">52.38617</span>],
        [<span class="hljs-number">4.87463</span>,<span class="hljs-number">52.37254</span>],
        [<span class="hljs-number">4.87875</span>,<span class="hljs-number">52.36369</span>],
        [<span class="hljs-number">4.88939</span>,<span class="hljs-number">52.35850</span>],
        [<span class="hljs-number">4.89840</span>,<span class="hljs-number">52.35755</span>],
        [<span class="hljs-number">4.91909</span>,<span class="hljs-number">52.36217</span>],
        [<span class="hljs-number">4.92656</span>,<span class="hljs-number">52.36594</span>],
        [<span class="hljs-number">4.93368</span>,<span class="hljs-number">52.36615</span>],
        [<span class="hljs-number">4.93342</span>,<span class="hljs-number">52.37275</span>],
        [<span class="hljs-number">4.92690</span>,<span class="hljs-number">52.37632</span>],
        [<span class="hljs-number">4.88330</span>,<span class="hljs-number">52.38617</span>]
      ]]
  }
}
</code></pre>
<p>&#x5F62;&#x72B6;&#x7D22;&#x5F15;&#x597D;&#x4E4B;&#x540E;&#xFF0C;&#x6211;&#x4EEC;&#x5C31;&#x53EF;&#x4EE5;&#x5728;&#x67E5;&#x8BE2;&#x4E2D;&#x901A;&#x8FC7; <code>index</code> &#xFF0C; <code>type</code> &#x548C; <code>id</code> &#x6765;&#x5F15;&#x7528;&#x5B83;&#x4E86;&#xFF1A;</p>
<pre><code class="lang-json">GET /attractions/landmark/_search
{
  <span class="hljs-string">&quot;query&quot;</span>: {
    <span class="hljs-string">&quot;geo_shape&quot;</span>: {
      <span class="hljs-string">&quot;location&quot;</span>: {
        <span class="hljs-string">&quot;relation&quot;</span>: <span class="hljs-string">&quot;within&quot;</span>,
        <span class="hljs-string">&quot;indexed_shape&quot;</span>: {                    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">1</span>&gt;</span>
          &quot;index&quot;: &quot;attractions&quot;,
          &quot;type&quot;:  &quot;neighborhood&quot;,
          &quot;id&quot;:    &quot;central_amsterdam&quot;,
          &quot;path&quot;:  &quot;location&quot;
        }
      }
    }
  }
}
</span></code></pre>
<blockquote>
<p> <img src="assets/1.png" alt="img">  &#x6307;&#x5B9A; <code>indexed_shape</code> &#x800C;&#x4E0D;&#x662F; <code>shape</code> &#xFF0C;Elasticesearch &#x5C31;&#x77E5;&#x9053;&#x9700;&#x8981;&#x4ECE;&#x6307;&#x5B9A;&#x7684;&#x6587;&#x6863;&#x548C; <code>path</code> &#x68C0;&#x7D22;&#x51FA;&#x5BF9;&#x5E94;&#x7684;&#x5F62;&#x72B6;&#x4E86;&#x3002;   </p>
</blockquote>
<p>&#x963F;&#x59C6;&#x65AF;&#x7279;&#x4E39;&#x4E2D;&#x90E8;&#x8FD9;&#x4E2A;&#x5F62;&#x72B6;&#x6CA1;&#x6709;&#x4EC0;&#x4E48;&#x7279;&#x522B;&#x7684;&#x3002;&#x540C;&#x6837;&#x5730;&#xFF0C;&#x6211;&#x4EEC;&#x4E5F;&#x53EF;&#x4EE5;&#x5728;&#x67E5;&#x8BE2;&#x4E2D;&#x4F7F;&#x7528;&#x5DF2;&#x7ECF;&#x7D22;&#x5F15;&#x597D;&#x7684;&#x8FBE;&#x59C6;&#x5E7F;&#x573A;&#x3002;&#x8FD9;&#x4E2A;&#x67E5;&#x8BE2;&#x53EF;&#x4EE5;&#x627E;&#x51FA;&#x4E0E;&#x8FBE;&#x59C6;&#x5E7F;&#x573A;&#x6709;&#x4EA4;&#x96C6;&#x7684;&#x4E34;&#x8FD1;&#x70B9;&#xFF1A;</p>
<pre><code class="lang-json">GET /attractions/neighborhood/_search
{
  <span class="hljs-string">&quot;query&quot;</span>: {
    <span class="hljs-string">&quot;geo_shape&quot;</span>: {
      <span class="hljs-string">&quot;location&quot;</span>: {
        <span class="hljs-string">&quot;indexed_shape&quot;</span>: {
          <span class="hljs-string">&quot;index&quot;</span>: <span class="hljs-string">&quot;attractions&quot;</span>,
          <span class="hljs-string">&quot;type&quot;</span>:  <span class="hljs-string">&quot;landmark&quot;</span>,
          <span class="hljs-string">&quot;id&quot;</span>:    <span class="hljs-string">&quot;dam_square&quot;</span>,
          <span class="hljs-string">&quot;path&quot;</span>:  <span class="hljs-string">&quot;location&quot;</span>
        }
      }
    }
  }
}
</code></pre>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; WS 2019 all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x4EF6;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;
2019-03-08 14:40:14
</span></footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="5_2_Aggregations.html#总结5_2" class="navigation navigation-prev " aria-label="Previous page: 总结">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="6_Geolocation.html#地理坐标点" class="navigation navigation-next " aria-label="Next page: 地理坐标点">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"地理位置","level":"7.1","depth":1,"next":{"title":"地理坐标点","level":"7.1.1","depth":2,"anchor":"#地理坐标点","path":"6_Geolocation.md","ref":"6_Geolocation.md#地理坐标点","articles":[{"title":"经纬度坐标格式","level":"7.1.1.1","depth":3,"anchor":"#经纬度坐标格式","path":"6_Geolocation.md","ref":"6_Geolocation.md#经纬度坐标格式","articles":[]},{"title":"通过地理坐标点过滤","level":"7.1.1.2","depth":3,"anchor":"#通过地理坐标点过滤","path":"6_Geolocation.md","ref":"6_Geolocation.md#通过地理坐标点过滤","articles":[]},{"title":"地理坐标盒模型过滤器","level":"7.1.1.3","depth":3,"anchor":"#地理坐标盒模型过滤器","path":"6_Geolocation.md","ref":"6_Geolocation.md#地理坐标盒模型过滤器","articles":[]},{"title":"地理距离过滤器","level":"7.1.1.4","depth":3,"anchor":"#地理距离过滤器","path":"6_Geolocation.md","ref":"6_Geolocation.md#地理距离过滤器","articles":[]},{"title":"按距离排序","level":"7.1.1.5","depth":3,"anchor":"#按距离排序","path":"6_Geolocation.md","ref":"6_Geolocation.md#按距离排序","articles":[]}]},"previous":{"title":"总结","level":"6.1.11","depth":2,"anchor":"#总结5_2","path":"5_2_Aggregations.md","ref":"5_2_Aggregations.md#总结5_2","articles":[]},"dir":"ltr"},"config":{"plugins":["github@^2.0.0","edit-link@^2.0.2","anchors@^0.7.1","include-codeblock@^3.0.2","splitter@^0.0.8","tbfed-pagefooter@^0.0.1","expandable-chapters-small@^0.1.7","anchor-navigation-ex@0.1.8","book-summary-scroll-position-saver","ace","emphasize","-lunr","-search","search-plus"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright © WS 2019","modify_label":"该文件修订时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"emphasize":{},"ace":{},"github":{"url":"https://github.com/wjw465150/Elasticsearch"},"book-summary-scroll-position-saver":{},"splitter":{},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"anchor-navigation-ex":{"isRewritePageTitle":false,"tocLevel1Icon":"fa fa-hand-o-right","tocLevel2Icon":"fa fa-hand-o-right","tocLevel3Icon":"fa fa-hand-o-right"},"expandable-chapters-small":{},"include-codeblock":{"check":false,"edit":true,"fixlang":false,"lang":"","template":"ace","theme":"chrome","unindent":true},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"编辑此页面","base":"https://github.com/wjw465150/Elasticsearch/edit/master"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchors":{},"search-plus":{}},"theme":"default","author":"WS","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Elasticsearch权威指南中文版","language":"zh-hans","gitbook":"*","description":"Elasticsearch权威指南中文版"},"file":{"path":"6_Geolocation.md","mtime":"2019-03-08T06:40:14.357Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-03-15T05:52:05.244Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-edit-link/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-book-summary-scroll-position-saver/book-summary-scroll-position-saver.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-ace/ace/ace.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-ace/ace.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search-plus/jquery.mark.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search-plus/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

